我试图从 c++ dll 中使用 pantheios 日志框架。我已经成功构建了 dll,它通过我的测试应用程序(C++ MFC 应用程序)执行。
我使用了包含以下内容的隐式链接:
#include <pantheios/implicit_link/core.h>
#include <pantheios/implicit_link/fe.simple.h>
#include <pantheios/implicit_link/be.console.h>
我的 DllMain 使用以下调用初始化 pantheios:
extern "C" const char PANTHEIOS_FE_PROCESS_IDENTITY[] = "FinishingLineController";
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
int panres = pantheios::pantheios_init();
if(panres < 0)
{
fprintf(stderr, "Failed to initialise the Pantheios libraries: %s\n",
pantheios::pantheios_getInitErrorString(panres));
return FALSE;
}
}
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
pantheios::pantheios_uninit();
break;
}
return TRUE;
}
当我执行以下代码时,我得到一个
Microsoft C++ exception: stlsoft::winstl_project::windows_exception at memory location 0x0013da84
pantheios::log_DEBUG("Test logging");
我试图使用显式链接而不是任何结果。