I'm not sure how restrictive this would be for you but perhaps you could try statically linking the runtime and mfc libraries rather than dynamically linking them?

2011/4/27 Christian Larsen <contact@dword.dk>
Den 27-04-2011 08:18, Daniel Bradburn skrev:

If you are linking boost thread statically, are you also linking MFC
and the C runtime statically?

No, I link dynamically to MFC and the C runtime. I use Visual Studio 2008 with SP1, and Boost version 1.45.0 (but tss_pe.cpp has not changed in 1.46.1 it appears).

Best regards,
Christian

2011/4/26 Christian Larsen <contact@dword.dk <mailto:contact@dword.dk>>


   Hello,

   I know this has been asked before, but I could not find a good
   solution. I'm experiencing problems with an application using both
   MFC and Boost.Thread. Specifically the assertion

   ASSERT(AfxGetModuleState() != AfxGetAppModuleState());

   in AfxCoreInitModule() fails. I link Boost.Thread statically into
   a DLL in my project.

   >From previous posts to this list and elsewhere, e.g.
   http://lists.boost.org/boost-users/2009/04/46929.php, I see that
   the issue is caused by setting _pRawDllMain in tss_pe.cpp.
   Commenting this line does "solve" the problem, but I would rather
   not have to hack the Boost source code this way.

   It seems there is a patch somewhere for this problem (referred to
   in http://lists.boost.org/boost-users/2009/04/47015.php), but it
   appears it never made it into the source. Is there any chance of
   this issue being solved in a better way?

   Best regards,
   Christian Larsen
   _______________________________________________
   Boost-users mailing list
   Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users