发布网友 发布时间:2022-04-23 03:15
共1个回答
热心网友 时间:2023-10-13 01:28
[StructLayout(LayoutKind.Sequential)]
public struct emxArray_real_T
{
public IntPtr data;
public IntPtr size;
public int allocatedSize;
public int numDimensions;
[MarshalAs(UnmanagedType.U1)]
public bool canFreeData;
public emxArray_real_T(double[] cSharpData)
{
var arraySize = Marshal.SizeOf(cSharpData[0]) * cSharpData.Length;
this.data = Marshal.AllocHGlobal(arraySize);
// ????
numDimensions = 1;
canFreeData = false;
}
}
在C对应的C结构看起来像这样:typedef struct emxArray_real_T
{
real_T *data;
int32_T *size;
int32_T allocated;
int32_T numDimensions;
boolean_T canFreeData;
} emxArray_real_T;
并在此说明。 期待任何谢谢!