You should use native string type instead of stl string:
In C++ it will be looks:
struct node
{
int x;
char y[256];
};
And in C# it will be wrapped
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Ansi)]
public struct node
{
public int x;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=256)]
public string y;
};
For Unicode you should change type char to wchar_t in C++ structure and CharSet attribute value in C# structure.
More info:
http://msdn.microsoft.com/en-us/library/s9ts558h.aspx[
^]
Regards,
Maxim.