Porting Delphi code to Kylix


[ DelphiLand FAQ ]

Posted by webmaster Guido on September 03, 2004 at 18:12:39:

In Reply to: Thank U posted by Kurian Varkey on August 31, 2004 at 10:30:19:

: Just one more question. I heard that if we compile a delphi program in kylix then, it can be run on linux platform. If i made a notepad application on windows platform, do i able to get the same flexibility and operation on linux.
-------------

For simple applications, you can load your Delphi source code files into the Kylix environment, compile the code and immediately see the Delphi app running on your X-window desktop. Kylix can read Delphi form files (.dfm files). The IDE will automatically update your code in places like the Uses clause. E.g. a "uses buttons" will be replaced by "uses QButtons".

If you open a Delphi form in Kylix, you will be told about every property, method, or component that Kylix can't deal with. Example: if the Delphi form file (DFM) has a setting 'DragKind' set, Kylix will tell you that this property does not exist and it will remove the setting from your DFM file.

If you want to compile a Delphi form under Kylix you also will most likely run into case sensitivity filename problems, such as:

{$R *.DFM} has to be replaced by {$R *.dfm}. Delphi saves the dfm file with a lower case extension. Kylix is case sensitive and will look for a DFM since the $R refers to that file.

Unit names and actual filenames might give you problems. If you never paid attention to what the actual filename is and what the Unit clause says you will get a compile error in Kylix.
-------------

But... if your Delphi code has typical Windows stuff (like HDC, HBitmap,...) or direct API calls (like for example CopyFile) or Windows-specific graphics stuff or database handling, you're out of luck: the X Windows API is very different from MS Windows, and you might have to rewrite big chunks of your code from the ground up.
--------------

Notes:

Kylix comes with a collection of components and controls, that you use when developing applications, just like Delphi. In Kylix, this is called the "Borland Component Library for Cross Platform", the "CLX". On the other hand, for Delphi, the Visual Component Library (VCL) is the backbone of Borland's IDE (except for the expensive top-of-the-line Delphi Studio for Windows, that also uses the CLX). CLX and VCL are completely different, but Kylix does it's best to replace VCL components with CLX alternatives.



Related Articles and Replies



[ Delphi Forum -- by DelphiLand ]