Cross-Platform Network Applications with Mono
Compiling C# programs is done by way of the mcs compiler. MonoBlog is compiled with this command:
mcs -r gtk-sharp.dll -r glade-sharp.dll \ -r XmlRpcCS.dll -r glib-sharp.dll monoblog.cs
The -r option indicates a resource the program needs; here, we simply need to specify which libraries MonoBlog uses. This produces a compiled bytecode file called monoblog.exe. To run the program, we need to run the Mono CLR with this file as a parameter:
Now, having developed the program on Linux, we can run the program on Windows or Mac OS X with a minimum of fuss. Simply copy monoblog.exe, monoblog.exe.config and monoblog.glade files to the other platform and run them using the Mono CLR, as shown above.
Figures 3, 4 and 5 show MonoBlog running on Linux, Windows and Mac OS X machines, respectively. No code has to be changed; the program works as is, as long as all the libraries MonoBlog uses are present.
Hopefully, this article has demonstrated how Mono and C# can be used to create cross-platform applications quickly and easily. You can develop on one platform and be assured that the program can run on any platform that runs Mono and the GTK libraries. The MonoBlog program itself is ripe for further experimentation. Some possible areas for improvement are extra formatting options, more detailed error reporting, using the GtkHTML# bindings to create an HTML preview window, and further implementation of the MetaWeblog API, such as adding the ability to delete posts from a Weblog.
Resources for this article: /article/7557.
Ian Pointer is an unemployed Computer Science graduate in the UK. He can be reached at firstname.lastname@example.org.
|SUSE Linux Enterprise High Availability Extension||Mar 29, 2017|
|smbclient Security for Windows Printing and File Transfer||Mar 28, 2017|
|How to Calculate Flash Storage TCO||Mar 27, 2017|
|Non-Linux FOSS: Don't Drink the Apple Kool-Aid; Brew Your Own!||Mar 27, 2017|
|Three EU Industries That Need HPC Now||Mar 25, 2017|
|HOSTING Monitoring Insights||Mar 24, 2017|
- smbclient Security for Windows Printing and File Transfer
- SUSE Linux Enterprise High Availability Extension
- Returning Values from Bash Functions
- How to Calculate Flash Storage TCO
- Non-Linux FOSS: Don't Drink the Apple Kool-Aid; Brew Your Own!
- Preseeding Full Disk Encryption
- Two Ways GDPR Will Change Your Data Storage Solution
- Chemistry on the Desktop
- Hodge Podge
- GRUB Boot from ISO