/*结构体原型
typedef struct {
unsigned int s;
unsigned int d;
unsigned int SP[4][4];
} A;typedef struct {
unsigned char mv;
unsigned char n;
B sb;
unsigned int cn;
unsigned int Seg[8];
int* r1;
unsigned char* r2[512];
} B; */
用C#怎么写
typedef struct {
unsigned int s;
unsigned int d;
unsigned int SP[4][4];
} A;typedef struct {
unsigned char mv;
unsigned char n;
B sb;
unsigned int cn;
unsigned int Seg[8];
int* r1;
unsigned char* r2[512];
} B; */
用C#怎么写
{
public char mv;
public char n;
public b sp;
public int cn;
public int[] Seg=new int[8];
...
}
简单的方法就是把struct当成class来写
struct中不能有new 不能赋值
一样报错 不能这么写
要用到那个[Mar..]什么的忘了
我是建议把struct当成class来写 反正是一样的调用
指针麻..........,Marshal里好像也有
错误信息:causes a cycle in the struct layout
Public Const C2 As Short = 8 Structure A
Dim s As Integer
Dim d As Integer
<VBFixedArray(C1, 4)> Dim Sig(,) As Integer
Public Sub Initialize()
ReDim Sig(C1, 4)
End Sub
End Structure Structure B
<VBFixedString(1), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=1)> Public mv As String
<VBFixedString(1), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=1)> Public n As String
Dim sb As B
Dim cn As Integer
<VBFixedArray(C2)> Dim Seg() As Integer Public Sub Initialize()
ReDim Seg(C2)
End Sub
End Structure