native dll calling with structs containing arrays of nested structs
Ok guys,
I posted a message a few days ago about my inability to pass a structure
that contained a nested structure to a native dll, and the response that I
received was helpful, but I was wrong with my first question. I cannot pass
a structure that contains a nested array of other structures to a native
dll; I get a run-time exception during the dll call stating that the field
<whatever> cannot be marshaled as a structure member.
Here's some sample code (using redefined points and rects in this example):
[StructLayour(bla bla)]
public class TPoint{
public int x=0;
public int y=0;
Quote:
}
[StructLayour(bla bla)]
public class TRect{
[MarshalAs( ?????? )]
public TPoint[] boundaries = new TPoint[2];
Quote:
}
Anyway, when I attempt to pass a TRect, I get the exception. I have tried to
specify Struct as the MarshalAs type, ByValArray with a subtype of Struct,
asAny, almost everything, and I can't get it to work..
any ideas?
Trey Hutcheson