我正在使用RGiesecke DLLExport庫來生成可以從構建於VC6上的舊應用程序中動態加載的C#DLL。它導出方法,並從VC6代碼中調用它們。沒問題。但是,只要我試圖聲明一個變量作爲我的.NET類中的任何一個,它就會崩潰。非託管導出(DLLExport)崩潰
//I tried CallingConvention = CallingConvention.StdCall too
[DllExport(CallingConvention = CallingConvention.Winapi)]
static void GetDwgReferences(string fileName)
{
//OK: inialize System classes of .net
DateTime dateTime = DateTime.Now;
//crashing here: declare a variable of my static class (.net assemebly)
//SafeString safeString;
//crashing here: declare a variable of my class (.net assemebly)
//Email email;
//crashing here: initialize an object of my class (.net assemebly)
//DwgXrefs dwgXrefs = new DwgXrefs();
//crashing here by declcare a variable of third-party library (.net assemebly)
//ExSystemServices _serv;
}
怎麼了?請幫忙。