public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: "Streithorst, Kip" <KSTREITH@ball.com>
To: <pthreads-win32@sources.redhat.com>
Subject: Win64 support
Date: Wed, 29 Mar 2006 21:35:00 -0000	[thread overview]
Message-ID: <C482FF98AE985A47B8C982FD429C9E34D1C3B8@daytonmsg2k3.AERO.BALL.COM> (raw)

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

                 reply	other threads:[~2006-03-29 21:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C482FF98AE985A47B8C982FD429C9E34D1C3B8@daytonmsg2k3.AERO.BALL.COM \
    --to=kstreith@ball.com \
    --cc=pthreads-win32@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).