Tuesday, April 21, 2009

Finally: One language, three worlds.

Eureka. At last. With the release of the System.Windows.Forms assembly for Mono a dream comes true. Well, this sounds a little over the top but it felt like that the first time I got my 'SimpleTerm' application running on Ubuntu. SimpleTerm is C# application for serial port (RS232) communication that I originally created for the PocketPC using SharpDevelop. By using only CLR functions that are available in the Compact Framework I could build an application that runs on a PDA and a desktop, unchanged!. So it was exactly the same bytecode on both platforms. Now this does not work on the Mono platform (although there seems to be a way to patch the bytecode itself) but after I imported the project into MonoDevelop and just compiled it, it actually worked ! Which could be considered as a breakthrough merely for the fact that it supports serial communication !. So it's not just a 'Hello World window' with an OK button but its a real application that even supports the most underappreciated form of digital communication. And I say 'underappreciated' because the RS232 specification was established in 1969 and it has been the main form of communication between computers for over 35 years. But it is only since the release of System.IO.Serialport in version 2 of the CLR that serial communication is really supported out of the box in a mainstream development framework. I know this is not an issue for most people, but if you are working with instruments and microcontrollers whose only means of communication is still plain RS232 it is a real revelation.
The image shown here is a combination of three screenshots, one of a PocketPC emulator, one from an Ubuntu system running within a virtual machine and one from a 'standard' Windows XP computer. The text in the main window of the application shows the result of a call to 'Environment.OSVersion' which indeed reports the operating system and version on all three systems.

1 comment:

Anonymous said...

but... hot to make a "hello world" sample app?