1.17k likes | 1.81k Views
Mono : A Free Software/Open Source Implementation of .NET for GNU/Linux, MacOS and Windows. Presentation Agenda. The Problem of Cross-Platform Portability Definition and History of Free Software Notable Examples of Free Software
E N D
Mono: A Free Software/Open Source Implementation of .NET for GNU/Linux, MacOS and Windows
Presentation Agenda • The Problem of Cross-Platform Portability • Definition and History of Free Software • Notable Examples of Free Software • Traditional Free Software Approaches to Cross-Platform Portability • Microsoft’s CLI Architecture and Implemenation for Software Components: .NET • Mono: A Free Software CLI Implementation • Mono on Win32 Natively • Mono on Linux (on top of Windows) • XSP ASP.NET 2.0 Web Server, Gtk# Application Framework • Porting a Multi-threaded VB.NET/Winforms app to C#/Gtk# • The Embeddable Mono Runtime on Win32 and Linux • Resources for Learning More • Similar Projects • Downloads • Web Sites • IRC Chat Channels
The Problem of Cross-Platform Portability • Ever since different processor architectures and different operating systems were developed, there have been problems with transporting software to different platforms due to: • Differing processor instruction sets • Differing system kernels and low-level libraries • Differing programming languages, call sequences • Differing binary and text formats for storing and transporting data and instructions • Differing company and academic agendas • The list goes on and on and on
“Free Software” Definition for This Presentation • Free Software: • “Free" software licenses grant: • the freedom to run the program for any purpose • the freedom to study and modify the program • the freedom to copy the program so you can help your neighbor • the freedom to improve the program, and release your improvements to the public, so that the whole community benefits • Freedoms 1 and 3 require source code access, because studying and modifying software without source code is extremely difficult and highly inefficient compared to modifying annotated source code. • - According to Richard Stallman of the Free Software Foundation • Source: http://en.wikipedia.org/wiki/Free_software
The Free Software Foundation Today the Free Software Foundation (FSF) supports many efforts around the world to promote the usage of free software. You can read more about the organization at http://www.fsf.org
GNU: (GNU’s Not UNIX) Well, if GNU’s Not UNIX then what is it? It’s Pretty Darn Close if You Ask Me The GNU project was launched in 1983 by Richard Stallman with the goal of creating a complete operating system -- called the GNU system or simply GNU -- that is free software, meaning that users are allowed to copy, modify and redistribute it.
www.GNU.org “Free software is a matter of freedom: people should be free to use software in all the ways that are socially useful. Software differs from material objects--such as chairs, sandwiches, and gasoline--in that it can be copied and changed much more easily. These possibilities make software as useful as it is; we believe software users should be able to make use of them.”
“Open Source” Definition On Line • An extensive definition of the related term “open source” is available at http://www.opensource.org • It addresses 10 points: • Free Distribution • Source Code • Derived Works • Integrity of the Author’s Source Code • No Discrimination Against Persons or Groups • No Discrimination Against Fields of Endeavor • Distribution of License • License Must Not Be Specific to a Product • License Must Not Restrict Other Software • License Must be Technology Neutral
Some Source Code is Freely Available, but Not Free Software An example of source code that is freely available but does not meet the defintion of “Free Software” above is Microsoft’s Shared Source CLI for the FreeBSD operating system because it explicitly forbids use of the code for commercial or open source projects. One criticism of shared source licenses is: The term shared source is primarily a marketing technique, deliberately meant to create confusion with open source among developers or management who have no prior experience. More specifically, the intent is to convince "the public" to use a shared source license as opposed to an open source license, or to give a company the appearance of more cooperative interaction with their user base than truly exists. Source: http://en.wikipedia.org/wiki/Shared_source
Notable Examples of Free Software Operating System Kernels and Distributions Linux FreeBSD
Notable Examples of Free Software Compilers and Debuggers The GNU Compiler Collection Alpha ARM H8/300 System/370, System 390 x86 and x86-64 IA-64 "Itanium" Motorola 68000 Motorola 88000 MIPS PA-RISC PDP-11 PowerPC SuperH SPARC VAX Ada (GCC for Ada akaGNAT) C C++ (GCC for C++ aka G++) Fortran (GCC for Fortran akaGFortran) Java (GCC for Java akaGCJ) Objective-C Support For: GDB: The GNU Debugger
Notable Examples of Free Software C System Libraries GLib and Gtk+, among many others
Notable Examples of Free Software Server Software Apache runs nearly 70% of all web servers – Netcraft Server Survey May 2005 BINDBerkeley Internet Name DomainThe most widely used DNS software Continues to be one of most widely used SMTP servers
Notable Examples of Free Software Relational DB Systems SAP DB is now MaxDB and Open Source 6 Million Installations:NASA Yahoo!SuzukiGoogleDepartment of Homeland Security Lycos Europe Evite CNET 3COM McAfee SAS Lucent “World’s most advancedopen-source database” See how they stack up side-by-side in a matrix comparison to MS SQL Server, Oracle, and DB 2: http://dev.mysql.com/tech-resources/crash-me.php
Notable Examples of Free Software Programming Languages PERL, PHP, Python, Ruby
Notable Examples of Free Software Office Software OpenOffice.ORG Featuring Writer, Impress, Math, Draw, Calc, Base
Notable Examples of Free Software X Server / Desktop Environments XFree86 KDE GNOME
Notable Examples of Free Software Bug Tracking System Mozilla BugZilla Used by: NASA Ximian IBM Apache GNOME KDENBC Universal Motorola
Notable Examples of Free Software Graphics Programs GIMP is nearing 10 years old! From GIMP have come: Gtk+, GLib, GNOME Libraries, etc…
Notable Examples of Free Software Microsoft Software FlexWiki (Collaborative document authoring, modeled after WikiPedia) https://sourceforge.net/projects/flexwiki/ WiX (Windows Installer XML file format/build tool for creating MSIs) http://sourceforge.net/projects/wix/ Software with Source Code Available, but is Not Free Software: Rotor (Shared Source CLI for Windows, FreeBSD, MacOS) http://msdn.microsoft.com/net/sscli
Notable Examples of Free Software Killer Apps FireFox 1.0
Notable Examples of Free Software The list goes on and on and on • Visit http://www.sourceforge.net for • 100,000 open source projects you can: • Download Freely • Redistribute Freely • Use Freely • Study Freely • Modify Freely • Contribute to Freely … Well, provided your • contribution passes code review ;-)
How Did Linux Get Started? Finnish born Linus Torvalds began the project in 1991, working to create a UNIX-like kernel for his PC. Over time it became more popular as different people contributed code and bug fixes and assembled their own custom collections of freely available GNU-based software to run on top of the Linux kernel Today there are hundreds of flavors of freely available GNU/Linux systems as well as commercially supported packages See http://distrowatch.com/ for information about different distributions
Cross-Platform Portability for Win32 and GNU/Linux: Traditional Free Software Approaches How can we execute the same code on both Windows and GNU/Linux systems?
Traditional Approaches to Win32 and GNU/Linux Portability • Cygwin • MinGW • Virtual Machines and coLinux
What is Cygwin? • Cygwin is a Linux-like environment for Windows. It consists of two parts: • A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality. • A collection of tools, which provide a Linux look and feel. • See http://www.cygwin.com
What is MinGW? MinGW is the “Minimalist GNU”. It contains the minimum amount of binaries needed to execute basic UNIX-like commands in Win32. It’s not as large as Cygwin. See http://www.mingw.org
Virtual Machine Software Virtual Machine software lets you boot one OS inside of another. • Popular Commercial Packages Inlcude: • VMWare • Microsoft Virtual PC • Free Software • Plex86 • QEMU (We’ll use this one in our demonstration) Just to note: an alternative approach is being explored at http://www.coLinux.org, which loads the Linux kernel side-by-side with the Windows operating system.
This is Great, But are There Other Ways to Write Portable Code for Win32 and Linux?
The .NET Architecture for Software Components Microsoft has submitted a part of the specifications of .NET to ECMA and ISO for standardization. This is a calculated risk, but it may encourage standards-compliant implementations, to provide an ongoing bridge for non-Windows software to be converted to Microsoft .NET.
.NET Framework Diagram Source: http://www.windowsitlibrary.com/Content/905/01/1.html
.NET Common Language Runtime Source: http://www.dotnetraptors.com.br/start/artigos/artigos_open_space/1403.aspx
Quick Refresher: The Unmanaged World C++ source VB6 source Compiler Compiler .obj PCode/x86 .exe Linker VBRun .exe Hardware Platform Loader Source: CLR 2005 Roadshow Slides Hardware Platform
Assembly Language Compiler Native Code JIT Compiler Execution Quick Refresher: The CLR Compilation Code (IL) Source Code Metadata At installation or the first time each method is called Source: CLR 2005 Roadshow Slides
.NET International Standards • ISO Standards for portions of the architecture: • ISO/IEC 23270 (C# programming language) • ISO/IEC 23271 (Common Language Infrastructure) • ISO/IEC 23272 (CLI TR) You can read more about the standardization process and read related documents here: http://msdn.microsoft.com/net/ecma/
ECMA 335: Common Language Infrastructure A Massive 518 Page Specification
ECMA 334: C# Language Specification Another heavyweight, tipping the scales at 490 pages
.NET Built-In Languages • C# programming language, an object-oriented language similar to Sun's Java • JScript .NET, a compiled version of Microsoft's JScript • J#, a Java and J++ (the Microsoft variant of Java) .NET transitional language • Managed C++, a variant of the C++ programming language for the .NET platform • Visual Basic .NET, an improved, object-oriented, multi-threaded version of the classic Visual Basic programming language
.NET Third Party Languages for the CLR See http://www.dotnetpowered.com/languages.aspx for dozens more • Ada, see A#. • APL • Boo, based on Python • COBOL • Component Pascal (Component Pascal is closer to Oberon than to Pascal) • Delphi 8 and Delphi 2005 • Eiffel • F# • Forth • FORTRAN • IKVM, Java • Lexico, a didactic in Spanish object-oriented language • Lisp • Mercury • Mondrian functional language designed to provide an easy way of scripting components • Nemerle functional/imperative hybrid language • Oberon • Perl • IronPython • RPG • Smalltalk
C# Sample • using System; • using System.Reflection; • namespace UVc { • public class UVcReflect { • public static void Main(string[] args) { • UVcReflect uv; • Type t = Type.GetType(“UVc.UVcReflect"); • Object o = Activator.CreateInstance(t); • uv = (UVcReflect) o; • Console.WriteLine(uv.testMe()); • Console.WriteLine("Now load an instance of an Arithmetic class and call its” • + " Perform method"); • Arithmetic d; • try { • t = Type.GetType(args[0]); • o = Activator.CreateInstance(t); • d = (Arithmetic) o; • Console.WriteLine(d.Perform(Convert.ToInt32(args[1]), Convert.ToInt32(args[2]))); • } catch (Exception) { • Console.WriteLine("Could not create an arithmetic object. Try Add or” + “Subtract"); • } • } • public string testMe() { • return "testing"; • } • } abstract public class Arithmetic { abstract public int Perform(int val1, int val2); } public class Add : Arithmetic { public override int Perform(int val1, int val2) { return val1 + val2; } } public class Subtract : Arithmetic { public override int Perform(int val1, int val2) { return val1 - val2; } } } • Demonstrates: • Run Time Type Information • Dynamic Class Loading • Polymorphism • Inheritance • Exception Handling
Compiling and Executing It • Flow of Events in Program: • Declare local variable uv of type UVcReflect • Ask the Type class to get a Type object for the class with full name of “UVc.UVcReflect” • Use the Activator class to instantiate an instance of that type. • Cast the object to a type of UVcReflect and assign to our local variable uv • Execute the testMe method on the type • Read the command line argument and attempt to load a type from it • Cast the type to type Arithmetic • Execute the Perform method on the object, passing two integer params to it
Introducing Project Monoa Free Software Implementation of the .NET CLI/CLR for GNU/Linux, MacOS, and Windows The Mono Project • Began by the Ximian Company, founded by GNOME Project founder Miguel de Icaza • Novell Bought Ximian in August of 2004 • Quote: “Mono is a platform for running and developing modern applications, based on the ECMA/ISO Standards. Mono can run existing programs targeting the .NET or Java frameworks.” • See http://www.go-mono.com or http://www.mono-project.com • All the code of the Mono project is Free Software, meaning that even if the companies behind it go away, the code is still free and open
What .NET Technologies are Included in MONO? • Mono contains a number of components useful for building new software: • A Common Language Infrastructure (CLI) virtual machine that contains: • a class loader • Just-in-time compiler, • and a garbage collecting runtime. • A class library that can work with any language which works on the CLR. • Both .NET compatible class libraries as well as Mono-provided class libraries are included. • A compiler for the C# language. See the FAQ: http://www.mono-project.com/FAQ:_General#What_is_Mono.E2.84.A2_exactly.3F
MonoDevelop: Free Integrated Development Environment See http://www.monodevelop.com
Mono: Main Tools • mono is the Mono runtime and Just In Time compiler (JIT) • mcs, Mono's C# compiler • gacutil is a tool used by developers to install versioned assemblies into the system Global Assembly Cache (GAC) to become part of the assemblies that are available for all applications at runtime. • mint, the mono interpreter • xsp, mono's stand alone ASP.NET web services and web application server • mono-config - Mono runtime file format configuration See: http://www.mono-project.com/Command-Line_Tools
Mono: Miscellaneous Tools • ilasm • monodis • monop • monostyle • sn • sqlsharp • cilc