Author Topic: "$if declared()" directive  (Read 8215 times)


  • Hero Member
  • *****
  • Posts: 3685
Re: "$if declared()" directive
« Reply #15 on: December 02, 2021, 02:45:55 pm »
In mode Delphi since some time in the 2.0.x series, in mode ObjFPC since 2.2.0 and for all modes since 3.0.

It can very well be that this isn't mentioned in the release notes. Not everything is mentioned there...

Allowing that the context- at least of the thread as started- is .lpr files which are normally IDE-generated I presume mode ObjFPC applies.

The oldest FPC that I can possibly see myself running is 2.2.4 in order to run Lazarus building a GTK v1 app. I can't realistically see any reason I'd want to do that.

I do have one elderly 32-bit laptop which I use on occasion for testing comms hardware; because of old display hardware there's a complex kernel -> libraries -> apps progression which limits me to something like Lazarus 1.6.4 + FPC 3.0.2 on it hence the original question.

I think it's reasonable to assume that nobody will be running anything older, unless I (or anybody else) starts looking at e.g. SunOS/Solaris again where the available variant was- I think- limited to GTK1. I've done it in the past but really don't know how that squares with the versions above since Jonas et al. did various SPARC fixes around 2.7.1... it might be that I was able to use 2.7 or 3.0 on that platform but had to disable various packages.

A bit of looking at IDE sources earlier suggests that the other automatically-inserted line started appearing around Lazarus 1.0.0; in view of the combinations of Lazarus and FPC which realistically work together it is probably always safe to edit the .lpr to read

Code: Pascal  [Select][+][-]
  1. begin
  2. {$if LCL_FULLVERSION >= 1000000 }
  3.   RequireDerivedFormResource:=True;
  4. {$ifend                         }
  5. {$if LCL_FULLVERSION >= 1080000 }
  6.   Application.Scaled:=True;
  7. {$ifend                         }
  8.   Application.Initialize;
  9. ...

Anything substantially older than Lazarus 1.0 is likely to have other problems caused by tabbed control and Synedit changes, plus possibly a change in the resource directive. But I'd be surprised if anybody seriously tried that and expected code that old to be portable without significant issues.

Thanks also to Alex.

MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories:


  • Hero Member
  • *****
  • Posts: 3664
  • Compiler Developer
Re: "$if declared()" directive
« Reply #16 on: December 03, 2021, 03:46:38 pm »
Yes, it is not mentioned at as I see. I don't know how to 'formulate it' in the wiki.

3.0.0 would be the wrong place anyway, as the original feature was added in 2.0.x, but only for mode Delphi.


TinyPortal © 2005-2018