$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [Thread] Solution to conflict with MFC?
From: gast128 (gast128_at_[hidden])
Date: 2011-04-26 12:02:41
Christian Larsen <contact <at> dword.dk> writes:
> 
> 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://listarchives.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://listarchives.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
I do not understand the problem nor the given solution completely, but we have
no trouble using Boost.Threads within a MFC application. However MFC can only be
used within its own threads, so as long as you don't call MFC from your Boost
threads there shouldn't be a problem.
Those module state asserts are often related to that or using MFC extension
DLL's from a non MFC environment.
Don't know if this helps u though.