Hi All !
I have a 2D array in C# and want handle it by c++.
I write code for C++:
extern "C"
{
__declspec (dllexport) void __stdcall MatrixH(unsigned char **mymatrix,int matwidth,int matheight)
{
mymatrix[0][0]++;
}
}
and compile it to mylib.dll.
And my code in C# :
static byte[,] mymat = new byte[10,10];
[DllImport("mylib.dll")]
extern static void MatrixH(byte[,] mymatrix,int matwidth,int matheight);
private static void MyHandle()
{
MatrixH(mymat,10,10);
}
When I run my code, a error was appear in function "MatrixH(mymat,10,10)":
"Attempted to read or write protected memory.This is often an indication that memory is corrupted."
Please! help me :(