Function pointer for unmanaged code in C #

I have a dll that takes a structure containing a pointer to a function to perform a callback.

How can I get IntPtr for the function of my application to build the structure?

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public class OPERATION { public uint OperationID; public IntPtr Context; public IntPtr Callback; -> How to pass this? } 

Here is the delegate accepting the OPERATION construct

 public delegate void MY_CALLBACK([In] OPERATION operation, [In] uint msgId, [In] IntPtr msgDataPtr); 
+4
source share

All Articles