我試圖從C++ dll中使用pantheios日誌框架。我已經成功構建了dll,並通過我的測試應用程序(C++ MFC應用程序)執行。從一個dll使用Pantheios日誌框架
我已經使用隱式鏈接與以下包括:
#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");
我試圖使用顯式鏈接,而沒有任何結果。
哇! 7小時,沒有迴應。當我面對同樣的問題時,我正在等待這個問題的答案。我有一個鏈接http://sourceforge.net/projects/pantheios/forums/forum/647484/topic/1639420,提出了類似的問題,但沒有嘗試過,看它是否會工作。 Joakim,如果鏈接有幫助,那麼告訴我,我會抽出時間親自嘗試。 – ossandcad 2009-09-22 21:14:20
我認爲你沒有提供足夠的信息來解釋這個問題。你只是在DLL中使用Pantheios,還是從DLL中導出其功能? (順便說一下,Pantheios團隊已經要求您提供關於您報告該問題的項目論壇的更多信息:http://sourceforge.net/projects/pantheios/forums/forum/475314/topic/3407328?message=7642468) – JamieH 2009-09-23 06:57:10
問題原來是與非pantheios有關。我用我找到的解決方案提供了我自己的答案。 – 2009-09-24 06:19:23