C
Chakravarthy Bollapalli \(IFIN SCC COM\)
Hi,
I get the exception
====exception=======
An unhandled exception of type 'System.TypeLoadException' occurred in
Test.exe
Additional information: Can not marshal field si of type ServersOnHost: This
type can not be marshaled as a structure field.
====exception=======
thrown when i try to collect the following structure returned by a method
in a managed c++ code.
c++ version:
struct servers_on_host_list_t {
u32 n_servers; /* Number of servers found */
server_info_t si[16];
};
c# version:
[StructLayout(LayoutKind.Sequential)]
public class ServersOnHost
{
public uint n_servers; /* Number of servers found */
[MarshalAs(UnmanagedType.ByValArray, SizeConst=16,
ArraySubType=UnmanagedType.Struct)]
public ServerInfo[] si;
};
I have searched all over the internet but couldnt find a solution to this.
Any pointer on how to solve it would be of great help.
TIA
kalyan
I get the exception
====exception=======
An unhandled exception of type 'System.TypeLoadException' occurred in
Test.exe
Additional information: Can not marshal field si of type ServersOnHost: This
type can not be marshaled as a structure field.
====exception=======
thrown when i try to collect the following structure returned by a method
in a managed c++ code.
c++ version:
struct servers_on_host_list_t {
u32 n_servers; /* Number of servers found */
server_info_t si[16];
};
c# version:
[StructLayout(LayoutKind.Sequential)]
public class ServersOnHost
{
public uint n_servers; /* Number of servers found */
[MarshalAs(UnmanagedType.ByValArray, SizeConst=16,
ArraySubType=UnmanagedType.Struct)]
public ServerInfo[] si;
};
I have searched all over the internet but couldnt find a solution to this.
Any pointer on how to solve it would be of great help.
TIA
kalyan