C#调用C++的dll
报错:
应用程序处于中断模式, 尝试读取或写入受保护的内存。这通常指示其他内存已损坏;
C++原型:
void GetTmpData(int type,BYTE * pbuff,float *maxtmp,int *maxx,int *maxy,float *mintmp,int *minx,int *miny,float *centertmp,float *tmparr,float *alltmp);
C#导入:
[DllImport(@"XthermDll.dll" , CharSet = CharSet.Ansi),]
public static extern void GetTmpData(int type, byte[] pbuff, ref float maxtmp, ref int maxx,ref int maxy,ref float mintmp,ref int minx,ref int miny,ref float centertmp,ref float tmparr,ref float alltmp);
调用时:
byte[] b = new byte[Buffer.Length];
float maxtmp = 0f;
int maxx = 0;
int maxy = 0;
float mintmp = 0f;
int minx = 0;
int miny = 0;
float centertmp = 0f;
float tmparr = 0f;
float alltmp = 0f;
GetTmpData(0, b, ref maxtmp, ref maxx, ref maxy, ref mintmp, ref minx, ref miny, ref centertmp, ref tmparr, ref alltmp);
各位大佬帮忙看看, 啥问题?感谢