[Mono-dev] Func parameter in embedded mono

pierre pierre.saunier at ppmodeler.com
Wed Mar 28 13:36:58 UTC 2018


Hi,


I am looking for info on how I can setup a callback in an embedded mono?

so, I can define in C#, something like:

Class Widget {

   private IntPtr _native;

   [MethodImplAttribute(MethodImplOptions.InternalCall)]

   static extern private void mono_set_callback(IntPtr widget, 
Func<Widget, Bool> callback);

   public void setCallback(Func<Widget, Bool>callback)

   {

     mono_set_callback(_native, callback);

   }

}

Is that correct?

what will be my C function?

void mono_set_callback(mono_widget_object *widget, ???? *callback) { ... }

and how can I call the callback from C? There is mono_runtime_invoke but 
it need an object (or NULL if static) and a method...

thanks,

Pierre



More information about the Mono-devel-list mailing list