Tuesday, May 08, 2007

Porting a Win32 Delphi Library to Linux

As I have mentioned in different posts, the primary product at my place of employment is developed for the Windows 32 bit platform, using Delphi. In the two previous posts, I looked into moving this code over to the .net platform, and came away fairly successful in the endeavor.

One of our existing partners asked us about providing our library on platforms other than Windows. This partner wanted the library to exist natively on many different Unix / Linux variants, and wanted to know would this be possible, etc.

A while ago, Borland offered Kylix, a product for both Windows and Linux. Unfortunately, that product is no longer offered, and I can only assume that the product was not as successful as Borland would have liked, given that it is no longer available. Furthermore, it was only functional for a given subset of the Linux platform, so I went looking for other ideas.

Next stop - Free Pascal. After looking over the site, I noticed that it seemed to offer quite a few platforms - 32 and 64 bit Intel processors, Windows, Linux, FreeBSD, Mac OSX, etc. However, how compatible is it with Delphi code?

There was only one way to find out, so I downloaded the .deb files (usable with my Ubuntu Linux box) and got hacking. After roughly one week of looking over the tools and available documentation, I have successfully compiled a shared library which contains a subset of the functionality provided in our native Windows product. I have compiled a C application which successfully links to this new shared library, which means that just about any language our there should be able to talk to it. Not too shabby!

Next, I need to port over the XML processing code to use the components provided in the Free Pascal component library, which may take a bit more time. However, I am very happy with the productivity and compatibility so far, and our partner was enthusiastic as well!


  1. is it possible for you to share your library

  2. Unfortunately, no - it is my company's primary commercial product.