C#调用C++DLL出现未处理的“System.AccessViolationException”类型的异常出现在.exe其他信息: 尝试读取或写入受保护的内存
我用C++写了处理程序 ,用C#写了界面,C#运行时出错。
string text_input;
string text_output="hello";
[DllImport("affactingDll.dll")]
static extern void affacting(ref string input,ref string output);
结果运行到调用下面语句 affacting(ref text_input, ref text_output) 时,出现“ 未处理的“System.AccessViolationException”类型的异常出现在.exe 其他信息: 尝试读取或写入受保护的内存”的错误,请问这是怎么回事啊?