c# 调用非托管的dll时,报
System.AccessViolationException”类型的未经处理的异常在 dllImport.exe 中发生
其他信息: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。错误。
代码如下:
[DllImport(@"G:\dr\测试工具\dllImport\dllImport\dll\xxx.dll", EntryPoint = "BUSINESS_HANDLE", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
private extern static int BUSINESS_HANDLE(IntPtr inputData, ref StringBuilder outputdata);
IntPtr inputData = Marshal.StringToHGlobalAnsi(this.textBox1.Text.Trim());
StringBuilder AOutputData = new StringBuilder(512000);
int iResult = BUSINESS_HANDLE(inputData, ref AOutputData);
4 个解决方案
#1
#2
原型是什么,调用约定一致吗,StringBuilder outputdata 还需要ref吗
#3
函数是
Function int BUSINESS_HANDLE(string inputData,ref string outputData)
#4
求助!!!!!!
#1
#2
原型是什么,调用约定一致吗,StringBuilder outputdata 还需要ref吗
#3
函数是
Function int BUSINESS_HANDLE(string inputData,ref string outputData)
#4
求助!!!!!!