对于在其他应用程序里调用的dll(regular dll using shared mfc dll),在debug模式下,一开始会出现两个断言错误:
(1) File:appcore.cpp Line:85
(2)File:appcore Line:92
解决方法:
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
本文介绍了解决在Debug模式下调用共享MFC DLL的常规DLL时出现的两个断言错误的方法。通过在每个导出函数开头使用AFX_MANAGE_STATE宏来确保正确管理状态,避免了与MFC DLL交互时产生的问题。
1万+

被折叠的 条评论
为什么被折叠?



