【发布时间】:2013-02-17 19:08:08
【问题描述】:
我有以下结构定义:
#ifndef struct_emxArray_real_T
#define struct_emxArray_real_T
struct emxArray_real_T
{
real_T *data;
int32_T *size;
int32_T allocatedSize;
int32_T numDimensions;
boolean_T canFreeData;
};
#endif /*struct_emxArray_real_T*/
并希望通过 PInvoke 在 C# 中使用它。该结构旨在表示一个矩阵。任何 C# 结构代码将不胜感激。谢谢!
有人尝试here:
[StructLayout(LayoutKind.Sequential, Size = 1)]
public unsafe struct mytype
{
public double* data;
public int* size;
public int allocatedSize;
public int numDimensions;
public bool canFreeData;
}
但没有让它工作。
【问题讨论】:
-
您的问题是如何翻译结构定义。如何填充其成员是完全不同的事情。
-
很公平。将发布另一个问题。
-
@David,我在这里发布了一个新问题:stackoverflow.com/questions/14925478/…