[Mono-list] C++ compiling question

Jonathan Pryor jonpryor at vt.edu
Sat Apr 18 21:58:21 EDT 2009


On Fri, 2009-04-17 at 11:12 -0700, NetSkay wrote:
> hi... im rather new to the mono project and .net in general...
> i know C++ is a low level language and there are other compilers

Yes.

> , and the language is compiled to byte code...

No.  C++ is compiled to native machine code (at least that's what
Microsoft CL.EXE, G++, and numerous other C++ compilers do).

Are you thinking of C++/CLI (as produce by `cl /clr:safe ...`)?

Or are you thinking C# and not C++?

>  so my question really is, if i code C++
> in mono, and i do NOT use the .net classes/modules, do i need to have mono
> installed on other machines/computers in order for the C++ compiled
> application to run
> and, what if i do use mono/.net modules, do i need to have mono/.net
> installed to run a compiled C++ application...

Two answers, depending on what you mean...

If you actually mean C++, you cannot currently compile C++ code to IL on
Linux (assuming that's important), and whether or not Mono is required
depends upon whether the C++ code is compiled to native code (e.g. by
using gcc) or to IL (e.g. by using `cl /clr:safe`).  If it's compiled to
IL, then Mono will be required, even if no .NET classes are used.

If you actually mean C#, then IL is always the output, so you will
always need Mono, even if no .NET classes are used.  You need mono for
the JIT, GC, etc. services.

However, requiring Mono is not the same as requiring that Mono be
installed; specifically, you can bundle Mono with your application with
mkbundle so that your app doesn't require an (external) Mono install:

        http://www.go-mono.com/docs/index.aspx?tlink=30@man%
        3amkbundle(1)

Additionally, with mkbundle there are no restrictions on which
assemblies you can use -- you can use any assembly, you just need to
ensure that it's bundled with your app.

 - Jon




More information about the Mono-list mailing list