how to call this C function in C#

  • Thread starter Thread starter ilikejunk1230
  • Start date Start date
I

ilikejunk1230

Hi,

I'm trying to call a C function whose header file looks like this:

int func(AB *foo, CD callback_function, EF *callback_client);

and the only declarations are

typedef struct AB AB;
typedef struct EF EF;
typedef int (*CD)(EF *client, int bar);

how would I import that into C#?

Thanks in advance
 
I just recently got done doing something like this...
Create a Managed C++ Class Library project. In it, create a "wrapper class" containing a function that calls the C function for
you.

Then add a reference to the Managed Library DLL to your C# project and call the necessary method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top