I have a embeded record in delphi like this:
TKernel = packed record
State: Integer;
end;
TKernels = array[0..19] of TKernel;
TShell = packed record
Kernels: TKernels;
end;
In this,
SizeOf(TShell) = 20 * SizeOf(TKernel).
But If I use C#:
struct Shell
{
Kernel[] Kernels;
public Shell(int i = 20)
{
Kernels = new Kernel[20];
}
}
then: Marshal.SizeOf(Shell) == 4
that means Kernels is just a pointer. I want to InterOp C# with Delphi, so I need there memory structure is the same, So how should I declare the struct in C# besides write 20 likes of Kernel KernelOne; Kernel KernelTwo。。。