Discussion:
Converting lazarus project to delphi
Sebastian Kraft
2006-02-14 12:39:44 UTC
Permalink
Hi...

Is it possible to compile a lazarus project with delphi without a huge amount
of changes in the code?

What has to be changed? Are there any tools to convert automatically?
Or can I export an lazarus project to delphi?

before you ask... I want to do this because win32 interface from lazarus lacks
some important features I need for win32 port of my software (Imagelist).

regards
sebastian
Micha Nelissen
2006-02-14 12:48:34 UTC
Permalink
Post by Sebastian Kraft
Hi...
Is it possible to compile a lazarus project with delphi without a huge amount
of changes in the code?
Read the Code_Conversion_Guide wiki page backwards ;-)
Post by Sebastian Kraft
What has to be changed? Are there any tools to convert automatically?
Or can I export an lazarus project to delphi?
before you ask... I want to do this because win32 interface from lazarus lacks
some important features I need for win32 port of my software (Imagelist).
Please help implementing them, instead :-). Marc is working on the
imagelists; you may want to try to contact him. (ATM he is on holiday IIRC).

Micha
Felipe Monteiro de Carvalho
2006-02-14 14:29:01 UTC
Permalink
Post by Sebastian Kraft
Is it possible to compile a lazarus project with delphi without a huge amount
of changes in the code?
You really don't need to convert from one to the other. A well
prepared project compiles with both.
Post by Sebastian Kraft
What has to be changed? Are there any tools to convert automatically?
Or can I export an lazarus project to delphi?
Just copy the lfm files and rename them to dfm. Next try to open them
on Delphi. If it complains, make some changes in the code on the dfm.
With some conditional compiles you can easely make a project
compatible with both.

There are some hints about making a project compile with both Delphi
and Lazarus. In particular here:
http://www.box.co.za/wiki/index.php/Roadmap_Linux#Lazarus

It's not hard at all to make it compile with both, a unit that
compiles with both looks like this:

unit myunit;

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

interface

uses
{$ifdef fpc}
// Free Pascal only units
LCLIntf, LResources,
{$else}
// Delphi only or Windows only units
Windows, Messages,
{$endif}

// Units available for both
Forms, SysUtils, Classes, StdCtrls, etc;

.......

implementation

{ifndef fpc}
{$R *.dfm}
{$endif}

.....

initialization

{$ifdef fpc}
{$I myform.lrs}
{$endif}

end.

--
Felipe Monteiro de Carvalho

Loading...