One of our long-standing goals has been that FieldWorks development could eventually be carried out on either platform, and target both platforms. Last month, the very first example of this started to happen.
Language software for Linux and Mac OS X
Today was a milestone. We demonstrated the Linux version of FieldWorks TE to a group of people at the office chapel time. It worked well enough for the demo, in that it wasn’t slow and didn’t crash, and the people were impressed
Progress has been very rapid in the past month or two, for several reasons, but today was the first time that we felt TE was ready to show to others. It was helpful to have the extra incentive of a scheduled demo for the final push to get things working on a non-developer machine.
Since we’re porting from SQL Server to Firebird, code that works on both RDBMSs is highly valuable. We want to connect to either using C#.
Our porting work depends on having a link from C# to C++ using COM. This is a fundamental requirement, and without it we cannot proceed. Although we’ve had this working in small test programs for a long time, it would crash badly when we tried it with our application (WorldPad, part of FieldWorks). We were fairly sure it was something we were doing wrong, but could never pin it down. Well, now Tom and Brent have found the solution!
The libcom COM Support Library version 0.4.0 has been released. This is the first release of libcom. libcom is licensed under the LGPL.
libcom implements a subset of Microsoft COM (Component Object Model) and supports both C++ and C# (via Mono) COM clients and servers on Linux. libcom is similar to ole32.dll in Windows.
libcom can be downloaded from http://linux.lsdev.sil.org/wiki/index.php/Downloads.
Update: libcom now has its own web page at http://linux.lsdev.sil.org/wiki/index.php/Libcom.
Recently we had a couple developers from other offices join us for LSDev Linux Brainstorming Week to learn from one another, talk about technology choices, and do some pair programming.
We were successful in making a C# application create a regular C# object and a C++ object (via libcom and RCW), pass the C# object to the C++ object, have the C++ object modify the C# object from native code, and then back in C# code observe that our C# object was indeed manipulated successfully from C++.
This capability to call back and forth between C# and C++ using COM is very important for porting several SIL programs to Linux, and we were concerned about whether it would even be possible with Mono. We found out several months ago that C# calling into C++ using libcom and Mono RCWs worked, and I was pleased to find that going the other direction, C++ calling C#, elegantly Just Works.
Eberhard and I largely reused existing libcom test code and just made some additions. The steps to perform this test and an explanation of what is happening can be found on our wiki here.
Most of this comes from the Mono project documentation roadmap available on the Mono site here.
Microsoft has published three versions of the .NET Framework.
1.0 came first, next was 1.1 which incrementally updated the previous version, then 2.0 was a considerable expansion from 1.1.
To the core of .NET an addition, called .NET 3.0 has been released. It is a set of new API’s that run on top of the .NET 2.0 installation. The Mono project has been keeping track of the improvements made in each release, some of the implementations that they have kept up with are:
- Core: mscorlib, System, System.Security and System.XML assemblies.
- ADO.NET: System.Data and various other database providers.
- ASP.NET: WebForms and Web Services are supported. Work on WSE1/WSE2 has also started.
- Compilers: C#, VB.NET and various command line tools that are part of the SDK.
- Open Source, Unix and Gnome specific libraries.
Note: The description of the releases is not complete. I am showing the parts of .NET that have been implemented in each release and some other classes. for a complete list they are available on the Mono web site. Read the rest of this post…
Our GUI development on Linux is done with GTK2+, and in the case of Mono, GTK#.
On a GTK based Linux system using Mono, this setup ‘just works’. It takes a little bit more setting up on Windows, but with a small amount of effort, it is possible to take compiled programs straight from Linux and run them on Windows with Microsoft .NET (It is also possible to use Mono on Windows).
This is the procedure I used to use GTK# on Windows:
The core of SIL FieldWorks was written in C++. New development in FieldWorks is done in C#, and ties into the C++ core through COM.
After much looking all over the Internet in January 2005, I basically concluded that not only does no one use COM in Linux, but no one wanted to (outside of big enterprise application ports to UNIX).
When both porting FieldWorks to Linux and making it cross-platform, we lose access to Microsoft’s COM implementation in Windows. We were originally going to use SWIG to generate C# wrappers around the C++ core libraries. All C++ methods would then be P/Invoked, and COM would be bypassed.
Someone just asked me,
What’s the best way to do a cross-platform product that has the native XXX look and feel?
It depends on exactly what you mean by native look and feel. There are several GUI toolkits that produce the right pixels, so that in a screen shot it would look just like an XXX application, but which still don’t produce an application that feels right. For example, on Mac, if you select a range of text and then press right-arrow, what happens? The insertion point should move to the right boundary of the previous selection. However, on Windows, it typically moves one character beyond that point. I find this inconsistency very frustrating in several of the cross-platform apps that I use regularly.
Also, applications may have the right pixels for all the individual controls, but the overall layout of their UI doesn’t feel comfortable for an XXX user. The classic example is the relative ordering of OK and Cancel buttons in dialogs. Most toolkits now take care of this transparently, but there are other things, such as the extent to which toolbars are used, that can be uncomfortable for users. For example, Mac applications typically use toolbars very sparingly, and Windows apps use them extensively.