[Mono-list] Events in embedded Mono?

Andreas Färber andreas.faerber at web.de
Sat Nov 25 10:34:38 EST 2006


Hello,

How does one react to managed events in native code?

One possibility I thought of was writing and loading managed code  
with a dispatcher method that p/invokes "__Internal".

Would it also be possible to create a delegate for a C function from  
native code and add that to the event directly?

I noticed:

* There is no mono_class_event_from_name function.
(so I would have to iterate over all events myself - maybe a hint  
that this is not (widely) used yet?)

* There is a mono_create_ftnptr function for converting a function  
pointer into a form always usable by Mono.
(but what is the expected function signature? is there a this-pointer  
preceding the arguments like in JNI?)

* mono_delegate_ctor has a gpointer addr parameter "pointer to native  
code" but also expects a MonoObject* "target object".
(what's that supposed to be? can/should it be NULL? or is it not  
intended to be used that way?)

The metadata sample shows how to iterate over events only. A similar  
question has been asked two years ago on mono-devel-list but appears  
unanswered.

Andreas


More information about the Mono-list mailing list