【发布时间】:2011-02-01 09:22:59
【问题描述】:
我有一个带有以下签名的 C 函数:
int my_function(int n, struct player **players)
players 是指向struct player 对象的指针数组的指针。 n 是数组中的指针数。该函数不修改数组,也不修改结构体的内容,返回后也不保留任何指针。
我尝试了以下方法:
[DllImport("mylibary.dll")]
static extern int my_function(int n,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)]
player_in []players);
但是,它将数据编组为指向结构数组的指针,而不是指向结构指针数组的指针。
【问题讨论】:
标签: c# .net interop pinvoke marshalling