Recent

Author Topic: Converting Delphi (Win64) project that uses VCL to Lazarus (Debian)  (Read 464 times)

JackDca

  • New Member
  • *
  • Posts: 16
I am new to both Delphi and Lazarus and would appreciate some help.

I am trying to convert a small Delphi Win64 project (written by someone
else) to build using Lazarus, with the goal of making a cross-platform
version, specifically a version that will build and run under Debian
Gnu/Linux. I'm using using Tools-Delphi Conversion-Convert DelphiProject
to Lazarus Project. My impression from reading various wikis is
that the conversion tool should replace references to VCL with
references to LCL. This does not happen - I get

Error="Problems when trying to find all units from project file ... "
Conversion Aborted.

The .dpr file contains

uses
  Vcl.Forms,
  ...

while the only .pas file contains

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,
  Vcl.Imaging.GIFImg, math;

I've done a search (not just on the Lazarus website) for a relevant
example or another wiki without finding anything. Can someone point me
at an example or provide some suggestions.

Perhaps I just need to manually edit all the "uses" clauses - if so, a list of
LCL equivalents to VCL units would help but so far I have not found it.

Thanks!

devEric69

  • Sr. Member
  • ****
  • Posts: 363
Re: Converting Delphi (Win64) project that uses VCL to Lazarus (Debian)
« Reply #1 on: December 27, 2019, 05:40:15 pm »
Hello (many things to say),

- first tip: replace each unit named xxx.yyyy, with {xxx.}yyyy.
- second tip: read how to write a multi-OS application, using the conditional compilation directives:
Code: Pascal  [Select][+][-]
  1. {$If defined(Windows)} ... {$ElseIf defined(UNIX)} ... {$EndIf}

my 2 cents :) .
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

wp

  • Hero Member
  • *****
  • Posts: 7642
Re: Converting Delphi (Win64) project that uses VCL to Lazarus (Debian)
« Reply #2 on: December 27, 2019, 05:41:24 pm »
I think the converter is not happy with the namespace units. Are you planning to use the same unit still in Delphi? If no, I'd edit the "uses" clause in an external editor and remove the namespace parts, i.e. make a "Forms" out of "Vcl.Forms". If yes, you should do the same but maybe leave the original "uses" clause and surround it by an appropriate version IFDEF - but normally the non-namespace units work in Delphi, too, unless FireMonkey is involved. I just want to say: make a backup copy of the Delphi project and its units before beginning the conversion.

There may be a problem with the GifImg unit which does not exist in Lazarus. Much of the GIF stuff is contained in the standard Graphics unit here, but there may be differences. Be aware...
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

JackDca

  • New Member
  • *
  • Posts: 16
Re: Converting Delphi (Win64) project that uses VCL to Lazarus (Debian)
« Reply #3 on: December 27, 2019, 06:07:46 pm »
Wow! Two replies in 20 minutes - thank you. I will try these suggestions.

JackDca

  • New Member
  • *
  • Posts: 16
Re: Converting Delphi (Win64) project that uses VCL to Lazarus (Debian)
« Reply #4 on: December 27, 2019, 06:53:05 pm »
Thanks to you both. I commented out the namespace references and removed the reference to GIFImage.The program now compiles and executes under Debian. Whether it actually works is another question - but this is the first step.

 

TinyPortal © 2005-2018