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

Ring, Kevin kring at agi.com
Fri Aug 26 19:31:46 EDT 2005


Thank you to everyone who responded!

I hadn't found cilc in my searching before - it certainly makes the
Embedded Mono approach seem less intimidating.

In playing with it some today, I was able to get some simple unmanaged
-> managed calls working on my Linux machine.  I haven't had much luck
on Windows, though, because of the dependency on glib.  I know I can set
up a whole Cygwin environment complete with glib and build my
application there... but is there a way to embed Mono in an application
built with Visual C++?  I apologize if this is a stupid question.

The purpose of all of this is to enable a large C++ application, which
has been ported to Linux and other Unix platforms with the aid of
MainWin, to continue to be portable as some of its components begin to
be implemented in C#.  So eventually, I'd like to have something that
can generate real C++ interfaces in order to better approximate COM
interop, which I suspect is what we'll be using on the Windows side.  It
sounds like it might not be terribly difficult to do this using an
approach similar to the one used by cilc.  I may be able to convince my
company to sponsor a developer closer to the Mono project to develop
such a thing, if that sounds at all interesting to anyone...just a
thought.

Thanks,
Kevin Ring


> -----Original Message-----
> From: Jonathan Pryor [mailto:jonpryor at vt.edu]
> Sent: Thursday, August 25, 2005 9:21 PM
> To: Ring, Kevin
> Cc: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] COM Interop, or something like it
> 
> 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