|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-10-27 14:51:42
John Dunn wrote:
> Pedro Lamarão said :
>>
>> I've suffered much with this in the past.
>> In my experiente if you try to fool the CLR and actually
>> compile your DLL withouth /NOENTRY random things may happen
>> from time to time.
>
> I'm not using any DLLs - I'm statically linking to libboost_threads.
> I'm confident of this since if I define BOOST_THREAD_USE_DLL it will
> complain about not being able to find the DLL instead of just
> crashing.
>
> Interestingly enough, if I define BOOST_THREAD_USE_DLL it works
> perfectly fine. So the issue is with linking to the static lib, not
> the dynamic one.
The static version of libboost_threads uses an underdocumented and little
known feature of the PE (Portable Executable) file format to install a hook
that is called on every thread exit (needed for TLS cleanup). It is possible
that CLR executables no longer support this mechanism. Your best bet would
be to switch to using a DLL, as its DllMain + DLL_THREAD_DETACH mechanism is
apparently still supported by the CLR runtime. See:
http://boost.cvs.sourceforge.net/boost/boost/libs/thread/src/tss_dll.cpp?revision=1.2&view=markup
http://boost.cvs.sourceforge.net/boost/boost/libs/thread/src/tss_pe.cpp?revision=1.4&view=markup
for the actual implementations in the two cases.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net