Recent

Author Topic: 200000 lines from Delphi to Lazarus  (Read 8675 times)

CyberDog

  • New member
  • *
  • Posts: 8
200000 lines from Delphi to Lazarus
« on: March 18, 2006, 11:58:34 am »
Hello again Lazarus experts,

at the end we want to transport a 200000 lines project from Delphi to Lazarus to be platform independent. Has someone expirience with such large projects in Lazarus? What about the "turn around time" program -> compile -> start -> test -> abort -> program again...? Can anyone imagine that such a big project might work?

Tanks for any comment,

CyberDog

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
RE: 200000 lines from Delphi to Lazarus
« Reply #1 on: March 18, 2006, 12:28:32 pm »
Does it contain many forms? You need to convert the forms and fix missing properties.

Also, does it use many third-party components? You will need a lazarus version of those.

Aside from that, most code should work as-is, just add the following code before the interface keyword on every unit and try to compile it with Free Pascal:

{$ifdef fpc}
  {$mode delphi}
{$endif}

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
RE: 200000 lines from Delphi to Lazarus
« Reply #2 on: March 18, 2006, 01:01:25 pm »
IIRC, Lazarus has only 100000 lines of code, but it has been developed. Turn around time is about two minutes, so for some issues I try to make sample apps.

CyberDog

  • New member
  • *
  • Posts: 8
RE: 200000 lines from Delphi to Lazarus
« Reply #3 on: March 18, 2006, 03:52:18 pm »
Thanks for your answers. We know that we would have a lot of work, as the goal to have a platform independent software is never for free ;-)

A 2 minute turn-around-time for 100000 lines of code is rather hard to bear. Do I always have to compile the whole stuff (build) or can I compile the altered parts only (make)? Or is the linker that slow?

Are there internet components available, such as an eMail client or a http client or a socket system?

Thanks again,

CyberDog

mattias

  • Administrator
  • Full Member
  • *
  • Posts: 139
    • http://www.lazarus.freepascal.org
RE: 200000 lines from Delphi to Lazarus
« Reply #4 on: March 18, 2006, 06:45:00 pm »
The lazarus IDE plus its IDEIntf is 180.000 loc. Codetools and SynEdit add another 120.000 loc.
You don't need a Makefile as the compiler is clever enough to compile only the changed units. A complete compile takes less than a minute on linux and two minutes on windows. A typical change in the IDE and recompile takes about 5-15 seconds under linux.
I'm currently improving the Delphi project converter for large projects and test converting turbocash, a 125.000 loc Delphi project.
The converter parses the .dpr, .dof and .cfg file for compiler options and search paths. It adds the {$mode Delphi} directive, fixes include directives and uses sections to for case. This is important for case sensitive filesystems. It comments missing units, adds LCL units, renames the .dfm files to .lfm. It checks the .lfm files for missing properties and classes.
At the end a browseable lazarus project is created. That means find declaration and all other codetools will work.
The converter can be stopped at any time and called again.

To improve the converter, I need some more Delphi projects. If you need help, or you want to help me improving the converter, you can send me the project personally.

CyberDog

  • New member
  • *
  • Posts: 8
We will try to work under Linux
« Reply #5 on: March 19, 2006, 04:09:16 pm »
So we will try to develop under Linux

This will cost some additional energy at the start, but I think it's worth it. If we could get some advice, we would be very grateful. We can also support the Lazarus project in different ways. Our project is a commercial one, so we would need to have a non-disclosure agreement first. But at the beginning we would like to experiment a little ourselves.

Thanks for all information, best regards, CyberDog.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: RE: 200000 lines from Delphi to Lazarus
« Reply #6 on: March 20, 2006, 01:24:08 pm »
Quote
Are there internet components available, such as an eMail client or a http client or a socket system?


There are some socket systems:

http://wiki.lazarus.freepascal.org/index.php/LNet

http://wiki.lazarus.freepascal.org/index.php/Sockets

About e-mail, I´m not sure, but probably ^^

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: 200000 lines from Delphi to Lazarus
« Reply #7 on: March 20, 2006, 08:17:27 pm »
Quote from: "CyberDog"

at the end we want to transport a 200000 lines project from Delphi to Lazarus to be platform independent. Has someone expirience with such large projects in Lazarus? What about the "turn around time" program -> compile -> start -> test -> abort -> program again...? Can anyone imagine that such a big project might work?


I've converted over 100,000 lines of Delphi code to Free Pascal and Lazarus, with partial success. Here's the things to keep in mind:

(1) If your code is partitioned into UI units and non-UI units, as mine was, the non-UI code should move over without too much trouble. I would imagine in a project of that size, you've already dealt with issue of partitioning and have the number crunching/database code in units that don't have any GUI.

(2) If your code uses only standard Delphi components, these too should move over pretty well. There are still some runtime behavior differences that I haven't resolved yet, but in many cases {$IFDEF} blocks can be used to work around things that behave differently. And the LC controls have gotten better and better over the last 6 months of so. Many of the remaining issues are obscure and detail things that you may not even notice.

(3) You don't mention whether you use any non-Delphi, 3rd party controls. If you do, you may be in for some serious work. I ported a number of 3rd party controls to Lazarus, with a moderate amount of effort, only to find that most of them simply don't work with Lazarus. It appears as though most of the runtime issues (crashes, etc.) I've run into with these 3rd party controls can be traced back to a dependency on Win API that the LCL either doesn't implement correctly or only partially implements. Of course, one of my goals with this porting was simly to investigate Lazarus and see how far I could get before attempting to port even a bigger project.

Since Delphi was only available for Windows, you can understand why 3rd party control writers treated the Win API as part of the RTL. But not all of the Win API is available with LCL and probably never will be, meaning you may have to rewrite any 3rd party controls yourself to get them to work.

(4) It's possible to maintain the same project in both Delphi and Lazarus. Then you can continue to do most of your development on Windows and Delphi and just use Lazarus to compile and test on other platforms. That way you don't lose the blazing compile-link performance of Delphi, but still have good cross-platform capability.

More details about your project would be helpful. I have no doubt that Lazarus and Free Pascal can handle a project of that size. However, 3rd party controls will be an issue that could prevent you from a successful port.