[Lazarus] porting delphi project code

Juha Manninen juha.manninen62 at gmail.com
Sun Jun 2 13:32:29 CEST 2013


On 6/2/13, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
> What syntax gives the error?

Codetools is not to blame here. The error comes because the authors
wanted compilation to break if a supported Delphi version is not used.
In this case it happens with Jedi libs but I have seen the same idea
used in other libs, too.
File jvcl.inc is included in most source files. It has tests :

{$IFDEF DELPHI5}
 {$I jvcld5.inc}
 {$DEFINE JVCL_CONFIGURED}
{$ENDIF DELPIH5}

{$IFDEF DELPHI6}
 {$I jvcld6.inc}
 {$DEFINE JVCL_CONFIGURED}
{$ENDIF DELPIH6}

... and so on for every Delphi and C++Builder version.
Then :

{$IFNDEF JVCL_CONFIGURED}
 {$IFDEF SUPPORTS_COMPILETIME_MESSAGES}
  {$MESSAGE FATAL 'Your Delphi/BCB version is not supported by this
JVCL version!'}
 {$ELSE}
  'Your Delphi/BCB version is not supported by this JVCL version!'
 {$ENDIF SUPPORTS_COMPILETIME_MESSAGES}
{$ENDIF !JVCL_CONFIGURED}

The {$ELSE} part is correctly triggered and throws an exception.

There is no way to convert Jedi libs for Lazarus. The converter only
should stop as gracefully as possible. I think it is rather good now
because it clearly tells where the conversion failed and now it
properly converts every file suggesfully parsed before the error.

Still, this is a PITA for the automatic conversion because it happens
with most non-trivial projects.

Sometimes codetools has thrown exceptions because of unusual code
which is still legal in Delphi. There was the old issue #16061 about a
strange use of {$IF...
I have not seen similar things recently, maybe codetools is so good now.

Juha




More information about the Lazarus mailing list