From mboxrd@z Thu Jan 1 00:00:00 1970 From: "van Lieshout, Fred" To: "'martin@gadgets.co.nz'" , "'pthreads-win32@sources.redhat.com'" Subject: Re: PThreads under win95 linked to missing export Date: Wed, 15 Aug 2001 13:20:00 -0000 Message-id: X-SW-Source: 2001/msg00112.html The source of the problem appears to be that InterlockedCompareExchange() "Requires Windows 98 or later" (according to MSDN).Dave--- Martin van den Nieuwelaar wrote: > The PTHREADVCE.DLL file is linked to missing export KERNEL32.DLL:InterlockedCompareExchange Martin, Just in case you really need the latest pthread lib, here's a work around that may do the trick: create your 'own' InterlockedCompareExchange function using some assembly code (not the best optimised, I know) and the Intel CMPXCHG instruction: extern PVOID InterlockedCompareExchange(PVOID *shared, PVOID v, PVOID c) { PVOID result; _asm { PUSH ecx PUSH edx MOV ecx,dword ptr [shared] ; Load ECX with plTarget MOV edx,dword ptr [v] ; Load EDX with lValue MOV eax,dword ptr [c] LOCK CMPXCHG dword ptr [ecx],edx ; if (EAX == [ECX]), ; [ECX] = EDX ; else ; EAX = [ECX] MOV dword ptr [result], eax POP edx POP ecx } return result; } With thanks to an article on MSDN (search on the function's name). Cheers, Fred