在 MFC dll 中包含 boost mutex header 文件时断言

Assert when including boost mutex header file in MFC dll

我有 header 版本的 boost 1_57。我想在我的代码中使用 object_pool 的功能。 但是我看到,如果我只是将此 header 文件包含到使用我的 mfc dll 项目编译的任何 .cpp 文件中,那么当我是 运行 程序时, dllinit.cpp 中会有一个断言使用此 dll 处于调试模式:

void AFXAPI AfxCoreInitModule()
{
    ASSERT(AfxGetModuleState() != AfxGetAppModuleState());
    ...
}

我看到 header 也包含并将其包含在我的 cpp 文件中也会导致断言。

这似乎是 Boost 中的一个问题(与 MFC 不兼容),在 _pRawDllMain 处理中。

请参阅此处了解可能的解决方案:http://boost.2283326.n4.nabble.com/Fwd-Thread-Solution-to-conflict-with-MFC-td3477977.html