[fpc-pascal] Re: Delphi incompatible conditionals?

Mark Daems mdaems at advalvas.be
Tue Oct 5 00:49:58 CEST 2010


> ---------- Doorgestuurd bericht ----------
> From: Martin <fpc at mfriebe.de>
> if you can put it after the uses clause (so you can have a const section, the following worked for me:
> {$IFNDEF FPC}
> const fpc_version=1; fpc_release=1;
> {$ENDIF}
> // your code below
> {$IFDEF FPC}
>  {$IFNDEF ver1}
>   {$IF (fpc_version>2) or (fpc_version=2) and (fpc_release>3)}
>     {$info FPC version >= 2.4.0 : Should work}
>   {$ELSE}
>     {$warning FPC versions below 2.4 are not supported. However :
> give it a try, you never know.}
>   {$IFEND}
>  {$ELSE}
>   {$fatal FPC version 1 isn't supported at all}
>  {$ENDIF}
> {$ENDIF}
>
Not an option : uses clauses may depend on the defines in the file.

>
>   {$IF Defined(fpc_version) and ((fpc_version>word(2)) or (fpc_version=word(2)) and (fpc_release>word(3)))}
>
> gets rid of the warnings
Works great on Delphi, but doesn't compile in fpc with following message:

Zeos.inc(49,9) Error: Compile time expression: Wanted INTEGER but got
STRING at "2 > word"

Also tried Marcov's Longint(2) instead of word(2). Same error.

Mark



More information about the fpc-pascal mailing list