Assuming that you want a struct containing a pointer to the array.
Declare the pointer to the array as IntPtr
and marshal the array contents manually with Marshal.AllocHGlobal
, Marshal.Copy
etc.
Assuming that you want a variable sized struct rather than a struct containing a pointer to the array.
You cannot marshal a variable sized struct using p/invoke. You have at least these two options:
- Break the struct into two parameters.
- Marshal the struct manually with
Marshal.AllocHGlobal
,Marshal.Copy
etc.