How do i convert the following structure declaration from c++ to c#?
#pragma pack(push,1) //Byte alignment
struct TtsrPlayerInfo
{
int PlayerID;
int ChannelID;
char NickName[30];
int PlayerChannelPr ivileges;
int PlayerPrivilege s;
int PlayerFlags;
};
#pragma pack(pop)
I've tried adding the following line just above the struct but it doesnt
seem to help. When the code runs i get a ExecutionEngine Exception.
[StructLayout(Sy stem.Runtime.In teropServices.L ayoutKind.Seque ntial, Pack =
1)]
What i'm trying to do is to get data from an external DLL imported using
DLLImport. I can get data from other dll calls just fine as long as the data
structure doesn't contain a char[].
Thanks,
Magnus Ullberg
#pragma pack(push,1) //Byte alignment
struct TtsrPlayerInfo
{
int PlayerID;
int ChannelID;
char NickName[30];
int PlayerChannelPr ivileges;
int PlayerPrivilege s;
int PlayerFlags;
};
#pragma pack(pop)
I've tried adding the following line just above the struct but it doesnt
seem to help. When the code runs i get a ExecutionEngine Exception.
[StructLayout(Sy stem.Runtime.In teropServices.L ayoutKind.Seque ntial, Pack =
1)]
What i'm trying to do is to get data from an external DLL imported using
DLLImport. I can get data from other dll calls just fine as long as the data
structure doesn't contain a char[].
Thanks,
Magnus Ullberg
Comment