我有一个C#classlibrary项目,里面我有以下方法:
public string GetPackagestring(string devID, string ConfigName)
{
//my code here
string ProgramName="VOT";
//here I call a c++ Dll function
packagestring = getparameters(devID, ConfigName, ProgramName);
//other part of code
}
调用外部dll函数时,我在packagestring行中获取了Stackoverflow异常。
在我的项目中,我将导入DLL,如下所示
public partial class Form1 : Form
{
//Import DLL
[DllImport(@"\DLL\testconfigdump.dll", CharSet = CharSet.Ansi, EntryPoint = "getparameters", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.BStr)]
public static extern string getparameters(string pumpid, string configname, string progname);
...
}
任何人都可以帮我解决为什么我会遇到stackoverflow问题吗? 消息说当前线程处于stackoverflow状态..