1
我有以下代碼開始運行在本地/ win32 c + +庫。從C++/clr冒泡錯誤到c#/ .net
// Load lt dll
OutputDebugString(L"LoadLtDll");
m_LTDll = LoadLtDll("C:/Program Files/Enciris Technologies/LT101 Driver H264/bin/encirislt_h264.dll");
if(!m_LTDll){
OutputDebugString(L"Library encirislt_h264.dll not found!");
throw new std::exception("Library encirislt_h264.dll not found!");
}
我需要std :: exception將消息向上吹到.NET應用程序。
它在.NET中顯示爲SEHException,但沒有傳遞給它的任何消息。我需要這個消息被吹到.NET。我該怎麼做呢?
在此先感謝!
你不能做這個工作,C++沒有二進制標準。它們的對象實現與特定的編譯器供應商和編譯器版本太重,以允許互操作。使用C++的標準.NET interop解決方案基於COM,C或C++/CLI。前兩種使用錯誤代碼,後者允許將C++異常轉換爲受管理的異常。 –