Implementations
The quick overview of the CLI and C# standards lays the foundation for exploring the various implementations of the standards. These are the well-known implementations. Who knows how many other implementations are out there that have not been announced or, like Palm 6, that have just been announced?
Microsoft's .NET CLR
The most widely used and generally available implementation is of course Microsoft's. It only makes sense that the creators of the standard have the first implementation. Figure 2-3 shows Microsoft's CLR.As you can see, Microsoft has added a whole slew of stuff to the CLI standard. Also in addition to the C# language, Microsoft provides Visual Basic.NET, C++.NET, Jscript.NET, and J#. .NET works on versions of Windows from Windows 98 to the latest Windows 2003 and beyond the next version of Windows, codenamed Longhorn, will have new APIs available only to Managed code! Although a rather large distribution, .NET has more functionality than any other CLI implementation currently available at the time of this writing. There is too much functionality to properly address everything in one portion of a chapter. For a great in-depth look at the .NET runtime and its internals, see:
Essential .NET Volume 1: The Common Language Runtime by Don Box and Chris Sells, Addison-Wesley
Microsoft has added the .NET runtime to the Windows Update site and to Windows 2000 and Windows XP service packs to aid in its distribution. It is the goal of Microsoft that in the near future, .NET can be assumed to be installed on all Windows client machines. In addition, the .NET runtime is installed by default on Windows 2003, and this indicates that it can be assumed to exist on any new operating systems from Microsoft. The .NET SDK is freely available from Microsoft and comes with some very good developer tools and probably the best graphical debugger available, as seen in Chapter 3, and Part II of this book, you can create a full-featured and well-integrated product that targets the Windows platform, all without paying a single dime.
Compact Framework
Not long after the .NET framework was released, Microsoft started beta testing the Compact Framework (CF) (see Figure 2-4 on p. 30). About a year after .NET's release, the Compact Framework was released. This framework is an implementation of the CLI target for Windows CE devices. Though only a subset of the CLI standard was implemented, the Compact Framework make mobile device programming easier than ever. The same programming model is available across devices, and both C# and VB.NET are available. However, each target device with different processors must be compiled for that target. Visual Studio.NET makes this programming much simpler via device emulators and integrated debugging on the devices through ActiveSync. Probably the nicest feature is the ability to consume Web services on a PDA; now that has potential! I also like the integration with SQL Server CE. However, you will notice that the CF has minimal XML support and is missing Remoting, Printing, and many other features available under the .NET CLR.
Figure 2-4. Microsoft's Compact Framework.
[View full size image]

SSCLI/Rotor
Microsoft teamed with Corel to create the Shared Source CLI (SSCLI), also know by its code name Rotor (see Figure 2-5). The SSCLI sticks pretty closely to the standards (except for the Jscript implementation) and is intended for academic and instructional study of how to implement a platform-independent CLI. Although useful for study, Rotor's Garbage Collection is not quite up to commercial quality. At the time of this writing, Rotor can run on FreeBSD, Windows, and OS X. For a great book on the specifics of the SSCLI, see David Stutz, Ted Neward & Geoff Schilling. Shared Source CLI Essentials, O'Reilly, 2002
Figure 2-5. Microsoft's Shared Source CLI.
[View full size image]

| Tool | Description |
|---|---|
| Cordbg | Provides command-line debugging services using the Common Language Runtime Debug API |
| Peverify | Performs type safety verification and metadata validation checks on an assembly |
| Sn | Enables strong naming of assemblies |
| Ilasm | Intermediate Language (IL) assembler |
| Ildasm | Intermediate Language (IL) disassembler |
| Ildbdump | Dumps Debug information from an assembly |
| Metainfo | Dumps the metadata information about an assembly |
Portable.NET
Rhys Weatherley leads the Portable.NET (http://www.southern-storm.com.au/portable_netl) Open Source implementation of the CLI (see Figure 2-6). Under the GNU project and the dotGNU steering committee, Portable.NET seems to be mainly focusing on the standards portion of the CLI similar to the SSCLI, but it is branching out into additional functionality by using TCL/TK for UIs and using some of Mono's implementations. Currently, Portable.NET runs on Linux, Windows, Solaris, and Mac OS X platforms. The Portable.NET> lower-level libraries as well as the runtime and compiler are written in C. The Portable.NET team's approach is a little strange in that they developed an interpreter first. Some implementations do not even have an interpreter, just a JIT compiler. This interesting approach may prove to be a very fast implementation of a JIT compiler. This implementation is definitely the smallest and most portable, seeing that almost every processor and operating system has a C compiler, making it a good candidate for embedding. Portable.NET is under the Gnu GPL Open Source license. (See Table 2.3.)
Figure 2-6. DOTGNU's Portable.NET.
[View full size image]

| Tool | Description |
|---|---|
| Ilasm | Intermediate Language (IL) assembler |
| Ildasm | Intermediate Language (IL) disassembler |
| Ilsize | Lists size information for each of the sections within the IL |
| Ilnative | Lists the native methods that are used within the IL |
| Ilfind | Searches for a pattern within the supplied IL input file |
| Resgen | Converts text files and .resx files to .resources files |
Mono
Ximian, the creator of many Open Source projects including the popular Evolution email client, created the Mono project under Miguel de Icaza's leadership (see Figure 2-7). Mono's intent is to implement full functionality and keep pace with Microsoft's CLR implementation. So far, Mono is doing a remarkable job; they even have started an Apache (http://www.apache.org) module to support ASP.NET fittingly called mod_mono. The System.* namespaces are coming along, and they are adding additional functionality in the Mono.* namespace. Mono is the only implementation to have both a JIT compiler and an Interpreter, which they call Mint. Mono currently runs on Linux, Windows, and Solaris. Interestingly enough, the JIT engine and much of the low-lever workings are in C. The C# implementation is solid enough to allow the C# compiler to be written in C#. Uniquely, Mono ships a GTK+ binding for C# called Gtk#. How Mono decides to implement System.Windows.Forms is being watched with great anticipation. Mono's Compiler is under the GPL, the runtime is under LGPL, and the libraries use the MIT Open Source licensing. Mono also includes the useful tools described in Table 2.4.
Figure 2-7. Mono.
[View full size image]

| Tool | Description |
|---|---|
| Cilc | CIL-to-C binding generator exposing any CIL library to C and C++ |
| Ilasm | IL assembler |
| Monodies | IL disassembler |
| Monoresgen | Converts text files and .resx files to .resources files |
| Monosn | Enables strong naming of assemblies |
| PEDump | Portable Executable dump utility |
| Secutil | Extracts the strong name public key of an assembly |
| Monodoc | A tool for creating documentation from XML comments in C# code. |
| Sqlsharp | SQL command-line client |
Implementation Quick Comparison
Although all of these CLI implementations are rapidly changing and really hard to compare, a comparison will reveal where these implementations are going.The following table on page http://weblogs.cs.cornell.edu/AllThingsDistributed/archives/000052l). This study is a part of the larger CLI-Grande effort (http://cli-grande.sscli.net/) and is a great idea if it can avoid advocacy issues and remain an objective study.
| Microsoft .NET | Mono | DOTGNU | SSCLI | Compact Framework | |
|---|---|---|---|---|---|
| Collections | X | X | X | X | X |
| Reflection | X | X | X | X | |
| Remoting | X | X | X | X | |
| Configuration | X | X | X | X | X |
| Diagnostics | X | X | X | X | X |
| IO | X | X | X | X | X |
| Net | X | X | X | X | |
| Security | X | X | X | X | X |
| Text | X | X | X | X | X |
| XML | X | X | X | X | |
| Threading | X | X | X | X | X |
| Drawing | X | X | X | X | X |
| Runtime | X | X | X | X | |
| Pinvoke | X | X | X | ||
| Component Model | X | X | X | X | X |
| CodeDom | X | X | X | X | X |
| Timers | X | X | X | X | X |
| Globalization | X | X | X | X | X |
| COM Interop | X | X | X | ||
| Windows Forms | X | X | X | ||
| WebASP.Net/Services | X | X | |||
| DataADO.Net | X | X | X | ||
| WMI | X | ||||
| Serviced Components | X | ||||
| Queues/MSMQ | X | X | |||
| LDAP/Active Directory | X | X | |||
| Windows | |||||
| Windows CE | |||||
| MAC OSX | |||||
| Linux | |||||
| FreeBSD |