C
C
couatl2011-04-28 00:32:15
C++ / C#
couatl, 2011-04-28 00:32:15

Passing/calling a C# function to/from a C++ dll?

There are dlls written in C++ and a C# project that uses this library.
What I would like to do : a dll function is called from C #, which starts the device check thread. When the device responds from the thread, the callback function is called, which calls the C# function.
Problem : pass a C# function to a C++ dll function to call later. I tried to make a dll function to pass the function to be called, with the input parameter as a function pointer, and in the initialization of this function in C #, write not a function pointer, but a delegate. I also tried, only specify the C# code as unsafe and write a function pointer instead of a delegate. Everywhere the compiler swore.
Question : how to call a C# function from a dll function in C++ or how to pass and call.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dzuba, 2011-04-28
@couatl

Try like this .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question