Re: [lazarus] Salvage Kylix apps with Lazarus IDE!

2007-12-28 Thread Vincent Snijders

Giuliano Colla schreef:

I must say it aloud: LAZARUS IDE IS GREAT.







If someone else has similar needs, I'm ready to share what I've done. 


Great article. I think it would be a good addition to our wiki.

Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Salvage Kylix apps with Lazarus IDE!

2007-12-27 Thread Giuliano Colla

I must say it aloud: LAZARUS IDE IS GREAT.

In a few days (I started on december 23, and didn't work too much, 
because of family parties dinners, lunches etc.) it made me possible to 
smoothly support Borland CLX Component Library, and to revive the dead 
Kylix. It appears that having been resurrected Lazarus has learned how 
to resurrect others! :-)


In the first attached screenshots you can see a form created with 
Lazarus IDE, and in the second the Kylix application running, which uses 
the Borland clx component library, developed,  compiled and debugged 
with Lazarus IDE. The Qt style is Platinum, and color is clLime, just to 
make it visibly different from the gtk counterpart.
In the platform I've been using for test (Fedora 5), Kylix IDE won't 
even start.


This is at a very early stage, but the ease with which I have attained 
the first results proves that it should be possible to salvage Kylix 
applications with a minimal fraction of the work required for porting 
from CLX to LCL.


For those interested, I will add some details.

Why:
In view of a much more ambitious project that I'll share with other 
Lazarus users if it turns out to be feasible and reasonable, I wanted to 
experiment how difficult is to use Lazarus IDE with an alternative 
"compatible" component library.
CLX is ready made and decently LCL compatible, so it could be used 
almost without writing code, and if it worked it could provide, as a 
side benefit, a way to salvage the dozens of Kylix apps my company is 
forced to support for a long time to come (they go into industrial 
machines, which cost a fortune, and therefore must be maintained at 
least for 10 years!)


How:
I've converted Borland CLX units to Lazarus units with the IDE function 
Convert Delphi Unit to Lazarus Unit. Then I've created a package, called 
clx, with all those units. CLX is intended to interface with Borland 
RTL, which is somehow different from FCL, so, where appropriate, I've 
minimally edited the clx units, and for the rest added a DelphiRTL unit, 
to collect a small number of required interface functions.
Using Lazarus resources requires the LResources unit, and a few sibling 
units. As Lresources resides in the LCL, I've lifted LResources unit and 
its siblings from LCL, renamed it to QLResources (to avoid name 
clashing) and created a second package named lres, with the required units.
That's almost all. An application which declare to require clx instead 
of LCL (this requires a minimal twigging with projects .lpr and project 
inspector to put things right), will use the clx library, Borland 
libborqt.so, and generate a Kilyx application which looks and behaves 
like the original.


What's missing:
Image resource files (i.e. stock button icons and a few more icons) have 
not yet been converted to Lazarus resources.
Delphi style localization is not supported (I don't use it, it required 
some extra work so I left it aside). Delphi style HelpSysytem neither 
(same reason). There's still some debug, mostly because Delphi 
widestrings support routines are not one-to-one with the FPC 
counterparts, and run-time errors pop up whenever an incompatibility is 
encountered.


What next.
Beside debugging everything properly, there are two things I'd like to test.
One of them is to compile the Lazarus IDE using CLX in place of LCL. 
This would make life much easier, because currently one can access with 
the object inspector only to the subset of properties which are common 
to LCL and CLX.
The other is to use the CLX3 Library, which uses a standard Qt3, instead 
of the Borland patched Qt2 of CLX.
But in both cases I'm unsure if it's worth while. After all my interest 
is to lengthen the life span of existing programs, not to develop new ones.


If someone else has similar needs, I'm ready to share what I've done. 
Only I'm unsure of licensing problems. I believe to be entitled to do 
what's possible to maintain the software we've developed with tools 
which were paid several thousands of good dollars for each license, and 
which were dropped, leaving users with bare hands, but I don't know what 
I can make publicly available. So, unless someone with sound legal 
knowledge can give assurances, I will just share those information 
privately.


Giuliano

<><>