By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,811 Members | 785 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,811 IT Pros & Developers. It's quick & easy.

ExecutionEngineException problems

P: n/a
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 PlayerChannelPrivileges;
int PlayerPrivileges;
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 ExecutionEngineException.
[StructLayout(System.Runtime.InteropServices.Layout Kind.Sequential, 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

Nov 15 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
struct TtsrPlayerInfo
{
//construct
public TtsrPlayerInfo() { }

//params
public int PlayerID;
public int ChannelID;
public char NickName[30];
public int PlayerChannelPrivileges;
public int PlayerPrivileges;
public int PlayerFlags;
}

-dec

g" <ma****@areaconsulting.us> wrote in message
news:e8**************@TK2MSFTNGP09.phx.gbl...
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 PlayerChannelPrivileges;
int PlayerPrivileges;
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 ExecutionEngineException.
[StructLayout(System.Runtime.InteropServices.Layout Kind.Sequential, 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

Nov 15 '05 #2

P: n/a
By the way...notice in my code there is no ; after the last }...this is
important if you missed it

"Magnus Ullberg" <ma****@areaconsulting.us> wrote in message
news:e8**************@TK2MSFTNGP09.phx.gbl...
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 PlayerChannelPrivileges;
int PlayerPrivileges;
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 ExecutionEngineException.
[StructLayout(System.Runtime.InteropServices.Layout Kind.Sequential, 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

Nov 15 '05 #3

P: n/a
Are you sure this is c# code?
I'm looking to convert this c++ code to c#..

"decrypted" <de*******@earthlink.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
struct TtsrPlayerInfo
{
//construct
public TtsrPlayerInfo() { }

//params
public int PlayerID;
public int ChannelID;
public char NickName[30];
public int PlayerChannelPrivileges;
public int PlayerPrivileges;
public int PlayerFlags;
}

-dec

g" <ma****@areaconsulting.us> wrote in message
news:e8**************@TK2MSFTNGP09.phx.gbl...
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 PlayerChannelPrivileges;
int PlayerPrivileges;
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 ExecutionEngineException.
[StructLayout(System.Runtime.InteropServices.Layout Kind.Sequential, 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


Nov 15 '05 #4

P: n/a

Hi Magnus,

Why do you think it is not C# code?
What problem do you get?

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "Magnus Ullberg" <ma****@areaconsulting.us>
| From: "Magnus Ullberg" <ma****@areaconsulting.us>
| References: <e8**************@TK2MSFTNGP09.phx.gbl>
<#A**************@TK2MSFTNGP11.phx.gbl>
| Subject: Re: ExecutionEngineException problems
| Date: Mon, 15 Sep 2003 08:23:42 -0500
| Lines: 57
| Organization: Area Consulting Group, Inc.
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uy**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: ky-owensboro1b-121.owboky.adelphia.net 24.52.178.121
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.csharp:184202
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Are you sure this is c# code?
| I'm looking to convert this c++ code to c#..
|
| "decrypted" <de*******@earthlink.net> wrote in message
| news:%2****************@TK2MSFTNGP11.phx.gbl...
| > struct TtsrPlayerInfo
| > {
| > //construct
| > public TtsrPlayerInfo() { }
| >
| > //params
| > public int PlayerID;
| > public int ChannelID;
| > public char NickName[30];
| > public int PlayerChannelPrivileges;
| > public int PlayerPrivileges;
| > public int PlayerFlags;
| > }
| >
| > -dec
| >
| > g" <ma****@areaconsulting.us> wrote in message
| > news:e8**************@TK2MSFTNGP09.phx.gbl...
| > > 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 PlayerChannelPrivileges;
| > > int PlayerPrivileges;
| > > 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 ExecutionEngineException.
| > > [StructLayout(System.Runtime.InteropServices.Layout Kind.Sequential,
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
| > >
| > >
| > >
| >
| >
|
|
|

Nov 15 '05 #5

P: n/a
public char NickName[30];

Syntax error, bad array declarator. To declare a managed array the rank
specifier precedes the variable's identifier.

I apreciate the help, someone in interop found a solution to my problem.

"Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
news:uz**************@cpmsftngxa07.phx.gbl...

Hi Magnus,

Why do you think it is not C# code?
What problem do you get?

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "Magnus Ullberg" <ma****@areaconsulting.us>
| From: "Magnus Ullberg" <ma****@areaconsulting.us>
| References: <e8**************@TK2MSFTNGP09.phx.gbl>
<#A**************@TK2MSFTNGP11.phx.gbl>
| Subject: Re: ExecutionEngineException problems
| Date: Mon, 15 Sep 2003 08:23:42 -0500
| Lines: 57
| Organization: Area Consulting Group, Inc.
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uy**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: ky-owensboro1b-121.owboky.adelphia.net 24.52.178.121
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08 phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.csharp:184202 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Are you sure this is c# code?
| I'm looking to convert this c++ code to c#..
|
| "decrypted" <de*******@earthlink.net> wrote in message
| news:%2****************@TK2MSFTNGP11.phx.gbl...
| > struct TtsrPlayerInfo
| > {
| > //construct
| > public TtsrPlayerInfo() { }
| >
| > //params
| > public int PlayerID;
| > public int ChannelID;
| > public char NickName[30];
| > public int PlayerChannelPrivileges;
| > public int PlayerPrivileges;
| > public int PlayerFlags;
| > }
| >
| > -dec
| >
| > g" <ma****@areaconsulting.us> wrote in message
| > news:e8**************@TK2MSFTNGP09.phx.gbl...
| > > 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 PlayerChannelPrivileges;
| > > int PlayerPrivileges;
| > > 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 ExecutionEngineException.
| > > [StructLayout(System.Runtime.InteropServices.Layout Kind.Sequential,
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
| > >
| > >
| > >
| >
| >
|
|
|

Nov 15 '05 #6

P: n/a

Oh yes, in C#, it should be like this:
public char [] NickName;

I am glad your problem got resolved.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "Magnus Ullberg" <ma****@areaconsulting.us>
| From: "Magnus Ullberg" <ma****@areaconsulting.us>
| References: <e8**************@TK2MSFTNGP09.phx.gbl>
<#A**************@TK2MSFTNGP11.phx.gbl>
<uy**************@TK2MSFTNGP09.phx.gbl>
<uz**************@cpmsftngxa07.phx.gbl>
| Subject: Re: ExecutionEngineException problems
| Date: Tue, 16 Sep 2003 08:11:27 -0500
| Lines: 110
| Organization: Area Consulting Group, Inc.
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uR**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: ky-owensboro1b-121.owboky.adelphia.net 24.52.178.121
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!cpmsftng xa06.phx.gbl!TK2MSFTNGP08.
phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.csharp:184538
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| public char NickName[30];
|
| Syntax error, bad array declarator. To declare a managed array the rank
| specifier precedes the variable's identifier.
|
| I apreciate the help, someone in interop found a solution to my problem.
|
| "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| news:uz**************@cpmsftngxa07.phx.gbl...
| >
| > Hi Magnus,
| >
| > Why do you think it is not C# code?
| > What problem do you get?
| >
| > Best regards,
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| > --------------------
| > | Reply-To: "Magnus Ullberg" <ma****@areaconsulting.us>
| > | From: "Magnus Ullberg" <ma****@areaconsulting.us>
| > | References: <e8**************@TK2MSFTNGP09.phx.gbl>
| > <#A**************@TK2MSFTNGP11.phx.gbl>
| > | Subject: Re: ExecutionEngineException problems
| > | Date: Mon, 15 Sep 2003 08:23:42 -0500
| > | Lines: 57
| > | Organization: Area Consulting Group, Inc.
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <uy**************@TK2MSFTNGP09.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | NNTP-Posting-Host: ky-owensboro1b-121.owboky.adelphia.net
24.52.178.121
| > | Path:
| >
|
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
| > phx.gbl!TK2MSFTNGP09.phx.gbl
| > | Xref: cpmsftngxa07.phx.gbl
| microsoft.public.dotnet.languages.csharp:184202
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > |
| > | Are you sure this is c# code?
| > | I'm looking to convert this c++ code to c#..
| > |
| > | "decrypted" <de*******@earthlink.net> wrote in message
| > | news:%2****************@TK2MSFTNGP11.phx.gbl...
| > | > struct TtsrPlayerInfo
| > | > {
| > | > //construct
| > | > public TtsrPlayerInfo() { }
| > | >
| > | > //params
| > | > public int PlayerID;
| > | > public int ChannelID;
| > | > public char NickName[30];
| > | > public int PlayerChannelPrivileges;
| > | > public int PlayerPrivileges;
| > | > public int PlayerFlags;
| > | > }
| > | >
| > | > -dec
| > | >
| > | > g" <ma****@areaconsulting.us> wrote in message
| > | > news:e8**************@TK2MSFTNGP09.phx.gbl...
| > | > > 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 PlayerChannelPrivileges;
| > | > > int PlayerPrivileges;
| > | > > 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 ExecutionEngineException.
| > | > >
[StructLayout(System.Runtime.InteropServices.Layout Kind.Sequential,
| > 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
| > | > >
| > | > >
| > | > >
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 15 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.