I have an unmanaged struct I’d like to marshal to c sharp that looks basically like this:
struct MyStruct{
/* ... some stuff ... */
int numChilds;
MyStruct *childs;
}
I believe that I have to write a custom marshaller but I’m not sure on how to proceed.
I like to use a setup like this when I don’t need to directly index children:
If you do need to directly index children, the easiest thing is creating a method
GetChild(shown below). The harder way is creating a helper/wrapper class that implementsIList<MyStruct>. An instance would be returned from theChildrenproperty, and its internal would work by calling theGetChildmethod. This is left as an exercise to the reader should he need it.