[Mono-list] How to send a message from C++ (native) code to Mono on Linux (using Xlib)

Chris Howie cdhowie at gmail.com
Sun Nov 30 13:03:52 EST 2008

On Sun, Nov 30, 2008 at 1:00 PM, Abe Gillespie <abe.gillespie at gmail.com> wrote:
> Chris,
> I think he's looking to expose events from the C++ lib that his .Net
> UI can consume, not call into the C++ lib from .Net.

Ah.  I'm not sure how the C++ library works in that sense, but if it
takes function pointers then you can do something else like:

void (*event_handler)(...);

Then in C#:

delegate void EventHandler(...);

Pass the delegate to the unmanaged code (make sure you keep a managed
reference to the delegate so it's not garbage collected) and then your
unmanaged code will in fact be calling into managed land when it uses
that function pointer.

Chris Howie

More information about the Mono-list mailing list