Die Kernfrage ist, wie man diese beiden Konstrukte zueinander kompatibel macht:
Delphi-Quellcode:
type
TMyStruct = packed record
Number: integer;
Msg: string[255];
end;
PMyStruct = ^TMyStruct;
Code:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct MyStruct
{
public int Number;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string Message;
}