私は、c#からCdllに渡される別の構造内に単純な構造を埋め込む方法を理解しようとしています。埋め込まれた構造をどのようにマーシャリングしますか?必需品まで取り除いた。
//The C code
typedef struct {
int a;
int b;
} A;
typedef struct {
int c;
A myStruct;
} B;
//The c# code:
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class A{
int a;
int b;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class B{
int c;
public IntPtr A;
}