Can I marshal a C-struct with a 2d array without using “unsafe”?
问题 I have a C DLL that I'm writing a C# interop class for. In the C DLL, one of the key methods fills a 2d structure; the structure is allocated and freed by helper methods, like so: // Simple Struct Definition -- Plain Old Data typedef struct MyPodStruct_s { double a; double b; } MyPodStruct; typedef struct My2dArray_s { MyPodStruct** arr; // allocated by Init2d; // array of arrays. // usage: arr[i][j] for i<n,j<m int n; int m; } My2dArray; void Init2d(My2dArray* s, int n, int m); void Free2d