【发布时间】:2015-08-06 11:09:57
【问题描述】:
如何将IntPtr 转换为数组。实际上,我从非托管 dll 中调用了该函数。它返回IntPtr。现在我需要将其转换为数组。请任何人给出一个想法。代码sn-p如下。
Unmanaged function declared
[DllImport("NLib.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe IntPtr N_AllocPt1dArray(NL_INDEX n, ref stacks S);
调用函数
void Function1()
{
IntPtr PPtr=N_AllocPt1dArray(n, ref S);
}
现在我需要将PPtr 转换为数组(数组为demo[])。其中demo 定义为
public unsafe struct demo
{
public int x ;
public int y ;
public int z ;
}demo DEMO;
【问题讨论】:
标签: c#