[Mono-list] how to marshal C style array in a struct
Lloyd Dupont
lloyd@galador.net
Thu, 15 Nov 2001 00:18:44 +0100
i have a C struct like
struct MyStruct
{
int len;
char * data;
};
i want to declare it in C# as something like (for interop)
[StructLayout(LayoutKind.Sequential)]
struct MyStruct
{
public int len;
[MarshalAs(UnmanagedType.LPArray)] public byte[] data;
}
hum.. but what could be cool is to have something like SizeParamIndex
attribute to give data.Length (instead of 1....), any idea, advice,
pointer ?
BTW SizeParamIndex work, but only in function, here it is a Struct...