0
我有以下结构定义:的PInvoke的结构
#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;
}
,但没有得到它的工作。
你的问题是如何翻译结构定义。如何填充其成员是完全不同的问题。 – 2013-02-17 19:56:54
够公平的。将张贴另一个问题。 – cs0815 2013-02-17 19:59:50
@David,我在这里发布了一个新问题:http://stackoverflow.com/questions/14925478/initialisation-of-struct-for-pinvoke – cs0815 2013-02-17 20:24:16