I spent the better part of last week trying to figure out how to bring in an old C++ DLL into my .NET code. It was quite surprising to find that most documentation on the net was only regarding bringing in COM components. The remaining documentation seemed to have spawned from one source and pasted over and over again (this has been happening a lot to me lately, i guess it's from diferent sites pulling from the same resource).
Anyways, it was fun to figure out how to reference an array of structs containing a byte[] to be imported. Here the trick that makes it work at least for me.
1)The function has to be defined as follows
functionname([MarshalAs(UnManagedType.LPArray)][In, Out] Struct[] s)
2)The struct can be defined as
Struct s{[MarshalAs(UnManagedType.ByValArray, SizeConst=1000)] public byte[] Data;}
It turned out to be pretty easy in the end, the process just hurt though :)