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

  • Home
  • SEARCH
  • 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 7540637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:41:28+00:00 2026-05-30T07:41:28+00:00

We hired a C programmer to develop a native component for use in a

  • 0

We hired a C programmer to develop a native component for use in a .NET application. We agreed on a conceptual API. I will pass his method two arrays and he will give back an array. I got the code today. Here is the header file. Real names are obscured:

__declspec(dllexport) int NativeMethod(
    struct params * config,
    int c_input_a_rows, 
    struct input_a_row *input_a_rows,
    int c_input_b_rows, 
    struct input_b_row *input_b_rows,
    int c_count, 
    int *p_c_output_rows, 
    struct output_row * output_rows);

struct params
{
    int a;
    int b;
    int c;
    double d;
    double e;
    int f;
    int g;
    char h[1000];
};

struct input_a_row
{
    int a;
    int b;
    double c;
};

struct input_b_row
{
    int a;
    int b;
    int c;
    int d;
    int e;
    double f;
    double g;
};

struct output_row
{
    int a;
    int b;
    int c;
    int d;
    int e;
    int f;
    int g;
    double h;
    double i;
    double j;
};

From this I generated .NET code using P/Invoke Interop Assistant. I was not able to get it to work by opening the DLL. It complained that the file has no assembly manifest. So I plugged the header file into the SigImpl Translate Snipped and got this:

[DllImport("the.dll", EntryPoint="NativeMethod")]
public static extern int NativeMethod(
    ref params config,
    int c_input_a_rows, 
    ref input_a_row input_a_rows,
    int c_input_b_rows, 
    ref input_b_row input_b_rows,
    int c_count, 
    ref int p_c_output_rows, 
    ref output_row output_rows);

It also create all as structs as expected. Each one has a class attribute:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]

Two questions. Did this code generate correctly? Second, how do I use it? The signature does not have arrays. I know I probably need to use pointers somehow, but how? I don’t expect you to solve this for me, but can you point me to some way to understand how to figure it out without taking a course in low native programming? 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-05-30T07:41:29+00:00Added an answer on May 30, 2026 at 7:41 am

    Okay, after I posted this question I started hacking away again. The first thing I tried worked!

        private static extern int NativeMethod(
            params config,
            input_a_row[] input_a_rows,
            input_b_row[] input_b_rows,
            int count,
            ref output_row[] output_rows);
    

    There’s one other thing I had to do. I was getting an error that entry point was not found. I solved this by using DUMPBIN (from VS console) to find out that the export was actually named ?NativeMethod@@YAHPAUconfig@@HPAUinput_row_a@@HPAUinput_row_b@@HPAHPAUoutput_row@@@Z. How fragile is that?!

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

Sidebar

Related Questions

I have hired a programmer overseas to develop a Drupal website for me and
I'm a contract programmer with lots of experience. I'm used to being hired by
I was hired by my current employer to develop an e-commerce solution. My manager
Hey. We're building a large ASP.NET website, and have hired an external firm to
Quick personal background: I was hired a few months ago as the sole .NET
I am fairly new to Git/GitHUB and I hired a programmer to make changes
I've been hired to develop a mobile framework for a webservice created by my
We've recently hired a design/ui/accessibility guy to give our asp.net MVC app a coat
I am not the only programmer, but I'm the only .NET developer, everyone else
i hired a designer who knows flash but not flex, is there a way

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.