我有以下C ++函数,我将在c#中创建包装函数:
byte* FunctionReturnVectorPoint()
{
return vectorPoint;
}
我试过了:
[DllImport("DLL_NAME.dll", CallingConvention = CallingConvention.ThisCall)]
unsafe public static extern byte*[] FunctionReturnVectorPoint();
但它不起作用。
您有什么建议吗?
答案 0 :(得分:1)
解决:
[DllImport("DLL_NAME.dll", CallingConvention = CallingConvention.ThisCall)]
public static extern IntPtr FunctionReturnVectorPoint();
以这种方式调用函数:
IntPtr tempPoint = FunctionReturnVectorPoint();
byte[] vector= new byte[dimensionVector];
Marshal.Copy(tempPoint , vector, 0, dimensionVector);