Your alternative to sqlite3_mutex_try() doesn't link on NT/2000/XP/Vista 
because you still
have TryEnterCriticalSection there instead of getting the pointer to it 
dynamically as Nicolas
suggested. So the current mutex_w32.c 1.4 does compile but won't link either.
http://www.sqlite.org/cvstrac/filediff?f=sqlite/src/mutex_w32.c&v1=1.3&v2=1.4

To link it you have to add 

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif _WIN32_WINNT

somewhere, I added it after the include guard in the amalgamation sqlite3.c of 
3.5.0 alpha,
which I have done now to remove a link error in my code and it works. Hope drh 
adds it in
the CVS.

I second that Win9X support should be dropped, it's as pointless as supporting 
MS-DOS now.
It should have been dropped when sqlite3 was released.

-- sword

On Wed, 05 Sep 2007 10:20:37 +0200
Ralf Junker <[EMAIL PROTECTED]> wrote:

> 
> >Isn't it time to drop the Win9X support from the default build?
> 
> I do not believe that just because Win9x is missing a single required call 
> justifies dropping support for it altogether!
> 
> >I'm thinking that any optimization should be enabled for the majority of 
> >users. Or if it's not really an optimization, why keeping it in the code 
> >then?
> 
> If possible, please keep the optimization.
> 
> >An alternative is to call this function when available using 
> >"GetProcAddress" (this is the case for a lot of other modern calls that 
> >cannot be done right now).
> 
> I second this alternative. 
> 
> According to http://msdn2.microsoft.com/en-us/library/ms686857.aspx, 
> TryEnterCriticalSection() is available on all Windows NT sytems. Therefore an 
> option to "GetProcAddress()" is checking for such OSes. The isNT() routine is 
> already part of os_win.c and is used there frequently:
> 
> static int isNT(void){
>     if( sqlite3_os_type==0 ){
>       OSVERSIONINFO sInfo;
>       sInfo.dwOSVersionInfoSize = sizeof(sInfo);
>       GetVersionEx(&sInfo);
>       sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;
>     }
>     return sqlite3_os_type==2;
>   }
> 
> 
> sqlite3_mutex_try() would then extend to something like this (untested!):
> 
> int sqlite3_mutex_try(sqlite3_mutex *p){
>   int rc;
>   assert( p );
>   assert( p->id==SQLITE_MUTEX_RECURSIVE || sqlite3_mutex_notheld(p) );
>   if( isNT() && TryEnterCriticalSection(&p->mutex) ){
>     p->owner = GetCurrentThreadId();
>     p->nRef++;
>     rc = SQLITE_OK;
>   }else{
>     rc = SQLITE_BUSY;
>   }
>   return rc;
> }
> 
> Ralf 
> 
> 
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to