I guess your C struct looks something like this:
struct MyStruct {
Array16 *data;
};
Because of the reference to the payload, I don't believe you can get the p/invoke marshaler to do the work for you. You'll need to marshal by hand.
In the C# code declare the struct like this
[StructLayout(LayoutKind.Sequential)]
public struct MyStruct
{
IntPtr data;
}
When you need to prepare such a struct for a function call do this:
MyStruct s;
s.data = Marshal.AllocHGlobal(16);
byte[] bytes = Encoding.Default.GetBytes("some string data");
Marshal.Copy(bytes, 0, s.data, Math.Min(16, bytes.Length));
If you need to read data that is returned by your function, use the same tactic in the opposite direction.
int nbytes = ... // probably returned by the function, no more than 16
byte[] bytes = new bytes[nbytes];
Marshal.Copy(s.data, bytes, 0, nbytes);
string returnedString = Encoding.Default.GetString(bytes);
When you have finished with the struct make sure you deallocate the memory by calling
Marshal.FreeHGlobal(s.data);
IntPtrand marshal the payload by hand.byte*requires unsafe code. No need for that.IntPtr, but you'll need more. In short, your question lacks some essential detail.