[Mono-dev] COM Interop, or something like it

Jonathan Pryor jonpryor at vt.edu
Thu Aug 25 21:21:17 EDT 2005


On Thu, 2005-08-25 at 16:27 -0400, Ring, Kevin wrote:
> In Microsoft’s implementation of .NET, it is possible to expose a
> class written in C# via a COM interface.  This makes it possible
> (perhaps even easy!) to instantiate C# objects and call methods on
> them from, say, a native C++ application.
> 
> Does Mono have a capability like this?

Yes.  Mono provides an embedding API which allows an unmanaged
application to create and use managed objects:

	http://www.mono-project.com/Embedding_Mono

This isn't terribly ideal, as it's a string-based API.  There is a
program called cilc which will take a managed class and generate a bunch
of C wrappers for each method exposed by the class.  This makes it easy
to use a managed class from C (and thus C++, if not perfectly from C++).

	http://lists.ximian.com/pipermail/mono-list/2003-April/013529.html

> I’d just like an easy way to instantiate managed objects and interact
> with them from a native C++ application.  I know I can embed Mono, and
> call methods that way, but it seems very cumbersome compared to COM
> interop.  Is there a better way?

Let cilc handle the cumbersome unmanaged->managed invocation layer.

 - Jon





More information about the Mono-devel-list mailing list