我正在使用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;
}
怎么了?请帮忙。