Mono Language Compilers on Debian
Several important options reveal the particularity of the Mono runtime. One aspect to keep in mind is that by default the Mono runtime behaves like a Just-In-Time (JIT) compiler. This means that while it interprets pieces of CIL byte code it also natively compiles and caches the same pieces in machine language. The performance advantages are straightforward. With the
–aot option, the Mono runtime also implements Ahead-Of-Time (AOT) compilation, meaning that it produces all the system-dependent binary code before execution. This maximizes performance by paying a little more at the start.
gmcs: Mono C# Compiler
In a managed-code development environment, every available compiler usually produces an executable for the virtual machine. As such, any .NET compiler produces a CIL executable. The compilers output an .EXE or .DLL file. The former program is called process assembly, the latter a library assembly.
If /usr/bin/mono runs CIL programs compiled with Visual Studio .NET, then you can produce CIL programs with Mono itself. The Mono framework offers a plethora of CIL compilers. The C# compiler is the most important because it is the reference for .NET, and like the CLR, it has become an ECMA standard (ECMA-334).
Three Debian packages, each with its command-line compiler, address by default different versions of CLI and C# (see Table 1).
Command |
Debian Package(s) |
C# Version |
CLI Version |
mcs |
mono-mcs |
1.0, 2.0 (partially) |
1.X |
gmcs |
mono-gmcs |
2.0 |
2.0 |
smcs |
mono-smcs |
3.0 |
2.1 (subset of 2.0 plus extensions) |
Table 1. Debian Packages to Address by Different Versions of CLI and C# |
 | |
Figure 1. Assemblies Written in Different Languages Interacting: Here is a schema of how assemblies written in different languages can interact on Mono and .NET. |
With regard to smcs, you install a compiler for runtime 2.1 that compiles applications for Moonlight, the open-source clone for Silverlight. Moonlight will be able to run all Silverlight executables, even outside the browser.
The list of additional languages you can program with the Mono platform is very long. All the languages available in Mono are also available in .NET and vice versa, at least in the sense that wherever the source code is compiled, the CIL code produced is "runnable" on the other platforms. As explained before, Mono offers a set of language compilers that produce CIL executables ready to run on Mono or .NET runtimes. However, some .NET compilers currently produce code that doesn't run on the Mono platform because these compilers don't compile to pure CIL (for example, the Microsoft Managed C++ compiler).
Table 2 lists the main Mono compilers you can install on Debian, and Figure 1 presents a summarizing schema of how assemblies written in different languages can interact and reuse one other (for example, a class library written in C# can be used by a program in IronPython).
Language |
Command |
Debian Package(s) |
Visual Basic 2005 |
vbnc |
mono-vbnc libmono-microsoft-visualbasic8.0-cil |
Boo |
booc |
boo |
Nemerle |
ncc |
nemerle |
IronPython |
ipy |
ironpython |
Table 2. Mono Compilers You Can Install on Debian |