Compiling for Mono
From RemObjects Software
This is a Oxygene Language Feature topic
Feel free to add your notes to this topic below.
One of the main goals with Oxygene is providing a solution that is 100% compatible with alternative implementations of the Common Language Runtime - such as Mono. Our goal is to enable developers to seamlessly target all major CLR platforms, the Microsoft .NET Framework and Mono.
One of the steps to enable this is Oxygene's support for building applications for linking directly against Mono assemblies from within the Visual Studio IDE. This enables developers to use one familiar development environment to develop applications - whether cross platform or just for Mono.
In the long run, our plans also include integration with other .NET IDEs, including MonoDevelop.
Furthermore, the Oxygene compiler itself is a fully managed application also and, as such, capable to run under Mono - allowing you to use the command line compiler to build your projects on any platform supported by Mono, from Windows, Linux to Apple Mac OS X and others.
Oxygene comes with samples tailored especially for Mono, illustrating how to build both cross-platform as well as Mono specific applications, including using Gtk# and Cocoa# for Mac OS X.
Options for developing using Mono
It is recommended that you use Mono 1.2.x and older, not 1.0 and you have the following options:
- Run the command line compiler under Mono (# mono Oxygene.exe …)
- Run the compiler under .NET or inside Visual Studio and set the Framework Folder setting of your project to point to the Mono library folder
Oxygene provides the {MONO} and {MONOFRAMEWORK} placeholders that can be used in the FrameworkFolder setting to refer to the default mono framework. When running the compiler under Mono, this is the same as using the default framework setting; under .NET/Windows this will determine the Mono folder based on what/where the latest Mono runtime is installed (via a registry setting made by the Mono installer). See Cross Linking.
Writing Cross-Platform Applications
In general, applications compiled with the normal .NET framework will deploy just fine for Mono, without special cross-linking. However, because certain differences exist between the two frameworks, it is recommended to test building against Mono once in a while (even if you won’t use that version for deployment). The simplest way to do this is to simply add an additional “Mono” configuration to the project and use the above {MONOFRAMEWORK} as the setting for the Framework Folder setting of this config.
Of course, when writing non-cross-platform applications just for Mono, linking to the mono dlls will also give you full access (compiler and IDE intellisense) to Mono-specific classes (such as the Mono.* namespace, Gtk#, etc.).
Debugging Mono Applications
- Debugging Mono applications in Visual Studio or Cordbg.
This will work in general - you can run mono applications in the debugger, set breakpoints, etc. There is one important limitation of which you should be aware in that the debugger will always load the MS version of mscorlib.dll. If you use Mono-specific stuff from that dll, you have a problem, but if your mono applications can handle running with that dll, all the other Mono dlls (such as gtk#) load fine in the debugger and you can run and test your applications.
- Debugging Mono applications in Mono.
Oxygene can generate .MDB debug symbols files for use with the mono debuggers (see Project Options - Build), when the compiler is running under Mono 1.1.x or later. If running under Mono 1.0 or under .NET (i.e cross linking), MDBs can not be generated.
Mono/XSP
You need at least Mono 1.1.8 to fully run ASP.NET applications under Mono’s XSP. There are certain bugs that were fixed for us in 1.1.8 that prevented some pages from running (though most asp.net applications would run fine with older mono versions).
See Also
Product: RemObjects Oxygene (formerly known as Chrome)
Current version: 3.0
Previous Versions: 'Joyride' (2.0), 'Floorshow' (1.5), 'Adrenochrome' (1.0)
Glossary — Keywords — Language Features — Platform Features — Samples — Articles — How To — Issues
Categories: Text | Oxygene | Language | Feature
