Single Sourcing Linux and Windows applications


Software developers who want to avoid development and maintainance of two entirely different program versions of their software for linux and microsoft windows whish to use the same source code for both operating systems.

Since both platforms are very different from their approach to software development, single-sourcing is not a simple task. Nevertheless there are several ways to go, and we'll discuss the use of wine, gtk and wxWidgets in this topic.

Using WINE to port existing windows applications

The windows emulator wine may be used to port existing windows applications to the linux environment. Wine may either be used to run a windows application as a windows-compiler EXE file without any changes, or it may be used as a library.

Using wine as a library usually means to recompile the applications using the gnu c compiler using the libwine.a to generate a new linux executable. This method creates a real linux application that does not need to be run under an emulator. Corel uses this approach for their port of coreldraw to linux, inprise ported delphi under the name kylix using that approach.

Using the emulator libraries slows down execution a bit, especially startup of programs takes longer as usual.

Using GTK to port existing linux applications

In the reverse direction it is possible to write the application initially for linux using the gtk libraries. The GTK libraries are much more powerful than the windows API functionality. The well-known Gnu Image Manipulation Program (GIMP) uses GTK for it's user interface.

Tor Lillquvist has developed a port of GTK for windows (9x and NT) allowing to compile GIMP for windows. Arktos has developed a windows 3.1 port of GTK, used in the "Telefonbuch für Deutschland" Application for Windows 3.1. The GTK, GDK and GLIB libraries used consume about 2,5 MByte.

Using these tools it is possible to develop applications using the free GNU-C compiler for win32 from cygnus or the Microsoft Visual C++ compiler.

The GUI designer application "glade" used for interface design is not yet available for windows, so GUI design is to be performed on linux and the generated source codes may then be compiler for windows.

We've had very good expiriences with this method.

Using the wxWidgets toolkit for new Development

wxWidgets is C++ library for platformindependend software development. For a windows programmer it takes the responsibility comparable to the Micsofoft MFC and contains code for a help browser, mime handling and many other complex stuff. We've used it ourself for complex software development using wxDesigner for the GUI design. It is very good.

See Also


Latest News