public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* Re: PThreads under win95 linked to missing export
@ 2001-08-15 13:20 van Lieshout, Fred
  0 siblings, 0 replies; 5+ messages in thread
From: van Lieshout, Fred @ 2001-08-15 13:20 UTC (permalink / raw)
  To: 'martin@gadgets.co.nz',
	'pthreads-win32@sources.redhat.com'

The source of the problem appears to be that InterlockedCompareExchange()
"Requires Windows 98 or later" (according to MSDN).Dave--- 
Martin van den Nieuwelaar <martin@gadgets.co.nz> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <997828638.29731.ezmlm@sources.redhat.com>]

end of thread, other threads:[~2001-08-15 13:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-15 13:20 PThreads under win95 linked to missing export van Lieshout, Fred
     [not found] <997828638.29731.ezmlm@sources.redhat.com>
2001-08-14 15:49 ` Martin van den Nieuwelaar
2001-08-14 16:21   ` reentrant
2001-08-14 16:40     ` Martin van den Nieuwelaar
2001-08-14 19:35       ` Ross Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).