Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9154245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:23:54+00:00 2026-06-17T12:23:54+00:00

I am a C++ developer so I do not have much experience with C#,

  • 0

I am a C++ developer so I do not have much experience with C#, however, I have to fix this problem anyway.

There is a C# GUI which is using some C++ DLLs. When calling one of the methods from one of the DLLs a System.ExecutionEngineException occurs. Obviously I cant step into the C++ code to see if there is a problem with this code. So I build a small C++ testing application and this one worked fine. The parameters the method is called with in the C# code also look fine to me (used the same values in my C++ testing app). Although there is a problem somewhere in the GUI which may or may not be related to this issue, the same executable started without Visual Studio works just fine.

I have currently no idea on how to find out what causes the problem. Any hints will be highly appreciated.

Call to method in C# code where caseID is of type int, paramID is of type System.Int32 and paramData is a custom struct.

getParameter(caseID, dataID, paramID, ref paramData)

The signature of the method in the C# code looks like this:

[ DllImport ("helper.dll", CallingConvention=CallingConvention.Cdecl/*, CharSet = CharSet.Auto*/ )]
public static extern ERROR getParameter(System.Int32 caseID, System.Int32 dataID, System.Int32 paramID, ref PARAMETER_DATA data);

The signature of the corresponding method in the C++ DLL looks like this:

ERROR _stdcall getParameter(const long caseID, const long dataID, long number, PARAMETER_DATA *data);

What does look odd to me is that the C++ code explicitly states that the method should be called with calling convention “stdcall” whereas the C# code want to use Cdecl. However, this code seems to have worked for quite a while now. I also tried to change both calling conventions to stdcall but that did not work either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:23:55+00:00Added an answer on June 17, 2026 at 12:23 pm

    The problem was that a struct member which is a char[] in C++ changed its size. In the C# code there was this attribute

    [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=11)]
    

    So I had to change the value of the SizeConst property. Don’t know why I didn’ see this when I first checked the structs for differences…

    I also fixed the calling convention issue and now everything seems to work fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm an experienced developer with not so much experience in jQuery. I have a
I have some inserts in a development environment to release, the developer has not
I'm not sure if this is possible (complete non-flash developer speaking), but we have
I am not a .NET developer, so there might be some basic things I
I have experience developing java web applications with Spring, but not so much with
Background: I'm an ASP.NET developer with not much of experience when it comes to
For security reasons (I'm a developer) I do not have command line access to
I am not a developer, but I have spent years testing and managing software
Sorry for the basic question - I'm a .NET developer and don't have much
I am new in android, I dont have that much of experience. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.