boost threads and linking boost statically into a DLL

Recently I had some trouble to linking boost statically into a DLL. After searching around I found that there has been a discussion on http://boost.2283326.n4.nabble.com/Fwd-Thread-Solution-to-conflict-with-MFC-... However it seems that the patch proposed there (see below) did not make it into the trunk. Has there been a special reason why this has not been included into the normal distribution? Cheers, Carlos /** * tss.cpp * * This file is intended to correctly build a dll using boost::thread * It is taken from * * http://boost.2283326.n4.nabble.com/Fwd-Thread-Solution-to-conflict-with-MFC-... * * $Id$ */ #include <windows.h> #include <boost/thread/detail/tss_hooks.hpp> extern "C" BOOL WINAPI RawDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID); namespace { BOOL WINAPI dll_callback(HANDLE h, DWORD dwReason, LPVOID p) { #ifdef _DLL if(!RawDllMain(static_cast<HINSTANCE>(h),dwReason,p)) return false; #endif // _DLL switch (dwReason) { case DLL_THREAD_DETACH: boost::on_thread_exit(); break; case DLL_PROCESS_DETACH: boost::on_process_exit(); break; } return true; } } extern "C" { extern BOOL (WINAPI * const _pRawDllMain)(HANDLE, DWORD, LPVOID)=&dll_callback; } namespace boost { void tss_cleanup_implemented() {} }
participants (1)
-
Carlos Empujon