Re: [Boost-users] Support for VS 2005 C++/CLI
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. Are you aware of any issues with static libs / initialization and the CLR? That seems to be the case here. John
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.
participants (2)
-
John Dunn
-
Peter Dimov