A
alexia
Hello all,
My C# application gets pointer to a struct allocated in C++ on the
heap using new.
The structure in C++ is:
typedef struct _H
{
int a;
char c[3];
}H;
My C++ does the following:
H * pMSG = new H;
and call C# application.
In my C# application I declared the struct as
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct H
{
public int a;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 3)]
public string TextLogMsg;
}
How can I cast the InPtr the C# gets to relevant C# struct?
thank you for your reply.
My C# application gets pointer to a struct allocated in C++ on the
heap using new.
The structure in C++ is:
typedef struct _H
{
int a;
char c[3];
}H;
My C++ does the following:
H * pMSG = new H;
and call C# application.
In my C# application I declared the struct as
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct H
{
public int a;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 3)]
public string TextLogMsg;
}
How can I cast the InPtr the C# gets to relevant C# struct?
thank you for your reply.