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 8919049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:55:00+00:00 2026-06-15T05:55:00+00:00

I usually use C# but have the pleasure to invoke a C method via

  • 0

I usually use C# but have the pleasure to invoke a C method via C++. So I wrote a C++ wrapper like this:

The C++ header file looks like this:

#pragma once

using namespace System;

namespace CSharpToCPP {

    public ref class SomeWrapper
    {
        public:
        double ReturnValue();
    };
}

The C++ code looks like this:

double CSharpToCPP::SomeWrapper::ReturnValue()
{
    return 1;
}

This gives me dll which I can reference in C#. The working code in C# looks like this:

class Program
{
    static void Main(string[] args)
    {
        SomeWrapper Wrapper = new SomeWrapper();

        Console.WriteLine(Wrapper.ReturnValue());
    }
}

Now I would like to create some data in the C++ method ReturnValue and invoke the C method with this signature:

real_T get_value(const e_struct_T parameters, real_T temp)

Can someone please be so kind and point me in the right direction which explains what a const e_struct_T is and how to create such data? The C code was automatically generated and should take a structure with known content. I tried to define a structure in the header file like this:

struct Parameters{
    double x;
    int y;
    char z1;
    bool z2;
};

and then populate it with data like this:

Parameters Ps;
Ps.x = z2;
Ps.x = 2.0;

before invoking get_value like this:

get_value(Ps, 10.0);

This does not work. Thanks!

  • 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-15T05:55:01+00:00Added an answer on June 15, 2026 at 5:55 am

    You must search for an header file containing the definition of e_struct_t, include in the calling file, and use a variable of that type to pass to get_value;
    By the way, if the target method you want to call from C# is pure C, you probably should consider better using P/Invoke ( a tutorial here ) directly instead of create a C++ wrapper. Furthermore by plain P/Invoke you will drastically simplify the deploy ( no additional dll needed )

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

Sidebar

Related Questions

I usually use a boolean 'firstTime' like this: in C++: bool firsTime = true;
I usually use this line to import file from out of the current folder
A quick JSTL question. I usually use scriptlets in my jsp pages, but have
I usually use sql parameters with queries, but in this case I need to
I have a software requirement like that: An app run on window but this
i have a question in Indonesia, we usually use 8,5 not 8.5 but when
We usually use builder pattern in java, like this: UserBuilder userBuilder = new UserBuilder();
In web development, I usually use Firebug. But now I have to use Wireshark
I usually use the Ruby on Rails framework but for this project I need
I haven't play enough with this and usually use mocks, but I wonder what

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.