public inbox for
 help / color / mirror / Atom feed
* Win64 support
@ 2006-03-29 21:35 Streithorst, Kip
  0 siblings, 0 replies; only message in thread
From: Streithorst, Kip @ 2006-03-29 21:35 UTC (permalink / raw)
  To: pthreads-win32

I am trying to compile the pthreads library under Visual Studio 2005 with Win64 support.  I able to compile the library fine using "nmake clean VC", I'm using the Win64 command-line prompt provided with Visual Studio 2005.  My problem is I ran the tests to verify the compiled binaries functionality.  The problem is that the mutex1 test fails with the following message:
Assertion failed: (pthread_mutex_destroy(&mutex) == 0), file mutex1.c, line 63
I researched this problem further and the problem is actually in pthread_mutex_trylock.c in the following section of code:
                             (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx,
                             (PTW32_INTERLOCKED_LONG) 1,
                             (PTW32_INTERLOCKED_LONG) 0))
The problem is that it appears during pthread dll start-up, it is trying to locate the InterlockedCompareExchange windows api function call in kernel32.  However, if you look at the current MSDN documentation on said function, for the Win64 platform this function is no longer being exported from kernel32.  Instead they have turned InterlockedCompareExchange into an intrinsic function by the name of _InterlockedCompareExchange.  Temporarily, I changed implements.h from
#define PTW32_INTERLOCKED_COMPARE_EXCHANGE ptw32_interlocked_compare_exchange
#ifdef _WIN64
#define PTW32_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
#define PTW32_INTERLOCKED_COMPARE_EXCHANGE ptw32_interlocked_compare_exchange
and this appears to get most of the tests to run.  There is a subsequent problem later in context1.c as shown below:
cl /D__CLEANUP_C /O2 /Ob0 /W3 /MD /nologo /Yd /Zi -I. context1.c /Fecontext1.exe
 /link /INCREMENTAL:NO pthreadVC2.lib ws2_32.lib
cl : Command line warning D9035 : option 'Yd' has been deprecated and will be re
moved in a future release
context1.c(128) : error C2039: 'Eip' : is not a member of '_CONTEXT'
        C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\include\
winnt.h(2368) : see declaration of '_CONTEXT'
and this appears to be with the fact the _CONTEXT is based upon the processor and so in Win64 mode this no longer works, not really sure how to fix.
In summary, 
Has anyone looked seriously at Win64 support for the pthreads library?  And is anyone interested in getting it working, besides myself?
I suspect there may be larger problems as well, because I know if you use /Wp64 flag to warning about possible 64-bit problems some additional warnings come up that may need to be dealt with.  In addition they now provide an InterlockedCompareExchange64 that works on LONGLONG instead LONG and we may need to be using that instead.
Kip Streithorst

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-29 21:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-29 21:35 Win64 support Streithorst, Kip

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).