I'm using native functions and have small problem with marshaling structs in c#. I have pointer to struct in another struct - e.g. C# declarations:
[StructLayout(LayoutKind.Sequential, Pack=1, CharSet = CharSet.Auto)] public struct PARENT { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string Name; [MarshalAs(UnmanagedType.Struct, SizeConst=8)] public CHILD pChild; } [StructLayout(LayoutKind.Sequential, Pack=1, CharSet = CharSet.Auto)] public struct CHILD { public UInt32 val1; public UInt32 val2; } In PARENT struct I should have a pointer to CHILD struct. I need to pass a 'pointer to reference' (of PARENT struct) as argument of API function.
There's no problem with single reference ("ref PARENT" as argument of imported dll function) but how to pass "ref ref" ? Is it possible without using unsafe code (with C pointer) ?
greetings Arthur
ref parent.pChild?