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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:13:53+00:00 2026-06-15T07:13:53+00:00

I am trying to interface some C/C++ code from C# via a dll. I

  • 0

I am trying to interface some C/C++ code from C# via a dll. I am not a fluent C/C++ programmer but use C# all the time. I am attempting to deal with these C/C++ types at the moment:

#ifndef struct_emxArray_char_T_1024
#define struct_emxArray_char_T_1024
struct emxArray_char_T_1024
{
    char_T data[1024];
    int32_T size[1];
};

#ifndef typedef_e_struct_T
#define typedef_e_struct_T
typedef struct
{
    emxArray_char_T_1024 value1;
    real_T value2;
    uint32_T value3;
    boolean_T value4;
} e_struct_T;

They were created by a third party tool. My unsuccessful C/C++ attempt to initialize value1 is as follows:

static char_T test[5] = { 'h', 'e', 'l', 'l', 'o'};

emxArray_char_T_1024 x;
x.data = test;
x.size = 5;

e_struct_T Parameters;
Parameters.value1 = x;
Parameters.value2 = 50;
Parameters.value3 = 3;
Parameters.value4 = FALSE;

I would like to ultimately expose a C# interface which takes the values:

PerformCPlusPlusComputation(string value1, double value2, int value3, bool value)

which initializes e_struct_T in C/C++. Any feedback would be very much appreciated. 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-15T07:13:55+00:00Added an answer on June 15, 2026 at 7:13 am

    The lines

    x.data = test;
    x.size = 5;
    

    contains two errors: The first is that you can’t assign one array to another, not even if they were the same size. Use e.g. std::copy to copy from one to the other.

    The other error is that the size member is an array as well, and you can’t assign a single value to an array. You have to assign to x.size[0].


    Correct lines could look like this:

    std::copy(std::begin(test), std::end(test), std::begin(x.data));
    x.size[0] = sizeof(test);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to control latest Sun VirtualBox via it's COM interface from Python. But,
I am trying to use a .NET DLL from Java code ( Through a
I'm trying to figure out how to redirect output from some FORTRAN code for
I am trying to use several functions from kernal32.dll. However, when my application tries
I am trying to port some code from Delphi to C# and I have
I am trying to convert some code to Objective-C from Java and I'm getting
I am trying to implement some interface changes in my app, based on the
I am trying to interface with my Arduino via Pyserial on OS X. I
I'm trying to use Gson with an interface: public interface Photo { public int
have a really annoying time developing some code for a set of UserControls that

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.