3
Answers

How to Marshal a struct array embeded in another struct

ting-fang.zheng

ting-fang.zheng

19y
3.5k
1
Hi Folks: I have difficult to marshal a sturct array in another struct. Both my managed and unmanaged codes are listed below. I appreciate anyone help me out! Thanks! Ting In unmanaged code: typedef struct { int z; char c; } A; typedef struct { int y; A a[3]; } B; In managed code: [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)] public struct A { public int z; public char c; } public struct B { public int y; public A[] a; //How to marshal it?????????? };
Answers (3)