I have struct which is defined in c++ Win32 DLL like the following:
typedef struct matrix
{
double** data;
int m;
int n;
} Matrix;
And there is a function:
Matrix getMatrix(void);
Matrix getMatrix()
{
Matrix mat;
mat.m = 2;
mat.n = 2;
mat.data = (double**) malloc (sizeof(double*) * 4);
mat.data[0] = (double* ) malloc (sizeof(double) * 2);
mat.data[1] = (double* ) malloc (sizeof(double) * 2);
mat.data [0][0]=1;
mat.data [0][1]=2;
mat.data [1][0]=3;
mat.data [1][1]=4;
return mat;
}
How can I capture the return value of this function If I'm using P/Invoke
from a C# Application