如何从intptr获取值数组。如何将int_ptr_arr指向的线索变成s1 [] ....意思是说我的s1 []应该包含10,100,15
如果它是Marshal.PtrToStringAnsi()的char **,它适用于我,但我想要它用于int **因为我没有像Marshal.ptrint()....等......
enter code here
Native code:
extern "C" __declspec(dllexport) int** __stdcall Array_hh()
{
int x=10;
int y=100;
int z=15;
static int* myArray[3] = {&x, &y, &z};
return myArray;
}
wrapper:
[DllImport("Native_DLL.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)]
public static extern IntPtr Array_hh();
void some_fun
IntPtr int_ptr_arr = Wrapper.Array_hh();
int k = 0;
int[] s1 = new int[4];