[Mono-list] mono support for C++

Jonathan Pryor jonpryor@vt.edu
Thu, 20 Jan 2005 07:26:04 -0500


On Thu, 2005-01-20 at 12:09 +0000, Kala B wrote:
> Hi,
> Just wanted to get some information on the plan for
> supporting C++ on mono. Has work already started for
> this? 

The current plan consists of this:

 1. Point at C++ code
 2. Say "Ha Ha" in Nelson's voice (from The Simpsons)
 3. Profit!

:-)

Humor aside, there are no plans within Mono to support C++, at least
that I've heard of.  Outside of Mono I can think of at least two
different approaches:

 1. Use a code generator such as SWIG that parses the C++ code and
    generates C wrapper functions and C# code which DllImports the
    C wrappers.

    Pro: This permits use of C++ code from C#
    Con: Not terribly elegant; Extra layer of C code may impact 
         performance.

 2. There was work on a WHIRL-to-IL compiler, which would compile C
    (and probably C++) into CIL which Mono could execute.

    However, I haven't heard any news about this in awhile, so I
    don't know if it's still being worked on.

Long-term, GCC may be an option.  Since GCC is migrating to a SSA tree
as an intermediate representation in GCC 4.0 (instead of the current
register-based representation), it will be easier to modify GCC to
support CIL output in the future.  Note, *easier*.  It may still be
quite difficult, and I haven't actually heard of anyone interested in
adding such support.  Pro: nearly any language GCC supports could
produce CIL.  Maybe.  Con: Is anyone working on this?

 - Jon