[Mono-list] Interop
Jonathan Pryor
jonpryor@vt.edu
Mon, 10 Jan 2005 18:00:38 -0500
On Mon, 2005-01-10 at 18:44 +0100, Javier Miguel Gonzalez wrote:
> Hello John,
>
> Did you mean that I can call SWIG to create a c++ wrapper for a Mono dll
> (managed)?
SWIG only creates managed wrappers for unmanaged code. You can't use it
to call managed code from C++.
As mentioned elsewhere:
http://lists.ximian.com/archives/public/mono-list/2004-December/024917.html
http://lists.ximian.com/archives/public/mono-list/2004-December/024929.html
http://lists.ximian.com/archives/public/mono-list/2004-December/024974.html
There are only three ways for unmanaged code to invoke managed code:
1. Through the use of callback functions (pointing to a delegate).
This is the only solution portable between Mono and .NET.
It is also problematic as it requires that the managed application
be "in control" (i.e. be the program that was launched).
2. Through Mono's embedding API. Cilc is an example of this, which
generates a GObject wrapper API for the managed object.
3. Through Microsoft's Hosting API, ICorRuntimeHost.
I know nothing about this, but see:
http://msdn.microsoft.com/msdnmag/issues/01/03/clr/default.aspx
This is unlikely to ever be supported under Mono due to its
COM-based API.
I know of no other alternatives.
- Jon