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