I have a C function with the following signature:
int my_function(int n, struct player **players)
players
is a pointer to an array of pointers to struct player
objects. n
is the number of pointers in the array. The function does not modify the array nor the contents of the structures, and it does not retain any pointers after returning.
I tried the following:
[DllImport("mylibary.dll")]
static extern int my_function(int n,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)]
player_in []players);
However, that marshals the data as a pointer to an array of structures, not a pointer to an array of pointers to structures.