Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  Trouble with precompiled binaries and USE_DECLSPEC_THREAD

Guest
Posted: Tue Dec 01, 2009 10:29 pm Reply with quote
Guest
The windows binaries available for download are compiled with
USE_DECLSPEC_TRHEAD.
This, according to the following link:

http://msdn.microsoft.com/en-us/library/2s9wt68x.aspx

can cause trouble on systems before Vista when using _declspec(thread)
compiled modules via LoadLibrary. It did happen to me with the ei libraries,
which I needed to use by wrapping them in a dll which was called by .net
with LoadLibrary. On windows XP, in order to work with the dll that wrapped
the ei libs using LoadLibrary, I needed to recompiled sources with cygwin
and remove USE_DECLSPEC_THREAD. On Vista it works out of the box.

There is a catch though when recompiling: When you remove the
USE_DECLSPEC_THREAD definition from the compiler args, the code fragment
that gets included due to the removal (TLS API calls in ei_pthreads.c)
contains a call to SwitchToThread which needs <winbase.h>. Winbase.h is
included in ei.h .But there is something wrong with the include order or the
/D compiler definitions order, which causes an unresolved symbol for
SwitchToThread() and i had to explicitly re-include winbase.h in
ei_pthreads.c

I would suggest defining USE_DECLSPEC_THREAD via a test for version (WINVER
or WIN32_WINNT or something, i cant remember now).


Sorry for not giving more details and maybe provide a patch suggestion, but
cygwin got uninstalled and I dont have VC++ on my machine.
If you cant reproduce and verify the problem easily please tell me and I
will try to get access to VC++ 2005 and reproduce details.

Thanks,
Vassilis


Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum