passing naitve function pointers to naitve code

  • Thread starter Thread starter MrPugh
  • Start date Start date
M

MrPugh

Hi!

I have a strange problem:

I need to wrap a C-function in a native DLL into a C#-class. This
function expects one C-function pointer out of a set of some
C-functions defined in the same DLL.

How can I access and pass such a C-function pointer to a C-function out
of C#?

Thank You!
Ruben
 
As far as im aware you just pass a delegate through to the C-function (via
P/Invoke) and it all works by "magic"! The C-dll will call back to your C#
delegate transparently.
 
Jack said:
As far as im aware you just pass a delegate through to the C-function (via
P/Invoke) and it all works by "magic"! The C-dll will call back to your C#
delegate transparently.

Sorry, my question was obviously bad phrased:

The function B(), which the native function A() in the dll should call
back, is also a native c-function in the same dll.
One way would be to wrap the function B() into a delegate. But this
would mean, that I jump from C# to A(), than back to the delegate in
C#, which calls the function B().

I would like to avoid that, if there is a way...

Thank you!
Ruben
 
Back
Top