Assuming you need a structure containing a pointer to an array.
Declare the pointer to the array as IntPtr and manually create the contents of the array using Marshal.AllocHGlobal , Marshal.Copy , etc.
Assuming you want a variable-sized structure, not a structure containing an array pointer.
You cannot marshal a variable-sized structure using p / invoke. You have at least these two options:
- Divide the structure into two parameters.
- Marshal structures manually using
Marshal.AllocHGlobal , Marshal.Copy , etc.
source share