This is the mail archive of the pthreads-win32@sourceware.org mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Win64 support


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:
?
? if (0 == (LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE (
??????????????????????? ???? (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
?
#ifndef PTW32_INTERLOCKED_COMPARE_EXCHANGE
#define PTW32_INTERLOCKED_COMPARE_EXCHANGE ptw32_interlocked_compare_exchange
#endif
?
to
?
#ifndef PTW32_INTERLOCKED_COMPARE_EXCHANGE
#ifdef _WIN64
#define PTW32_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
#else
#define PTW32_INTERLOCKED_COMPARE_EXCHANGE ptw32_interlocked_compare_exchange
#endif
?
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
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.
?
Thanks,
Kip Streithorst


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]