6

There are a few corrected issues in the VCL which had previous workarounds. Is there some method to identify that Delphi 11.1 is in fact installed and not 11.0 so the fix can be used rather than the workaround? The compiler defines for RTLVersion and CompilerVersion have not changed and are still 35.0. The static compiler define is also still VER350.

skamradt
  • 15,366
  • 2
  • 36
  • 53
  • 1
    "*The compiler defines for RTLVersion and CompilerVersion have not changed and are still 35.0*" - if there have been changes in the RTL, `RTLVersion` should have been incremented. If it wasn't, Embarcadero would need to fix. But, if the changes are only in the VCL, then there is no `VCLVersion` constant that you can check for. – Remy Lebeau Mar 16 '22 at 18:56

1 Answers1

9

There is RTLVersion111 constant which you can use to determine whether you are dealing with 11.1

const
  RTLVersion111 = True;

{$IF RTLVersion111}
  Writeln('DEFINED RTL 11.1');
{$ELSE}
  Writeln('NOT DEFINED RTL 11.1');
{$IFEND}
Dalija Prasnikar
  • 27,212
  • 44
  • 82
  • 159
  • Shouldn't you be using `{$IF DECLARED(RTLVersion111)})` instead? Also, are older constants, like `RTLVersion1041` and `RTLVersion1041`, still being declared? – Remy Lebeau Mar 16 '22 at 19:00
  • @RemyLebeau It is a boolean constant so it can be used as-is. It is more readable this way. Older constants are not defined. For distinguishing major versions, one would use `RTLVersion` and then combining conditional compilation with `RTLVersion111` or other constants depending on particular code requirements. – Dalija Prasnikar Mar 16 '22 at 19:57
  • 2
    So the `RTLVersion111` constant is declared even in versions prior to Delphi 11.1, with the value `False`? Ah, you rely on this property: ["If the identifiers referenced in the conditional expression do not exist, the conditional expression will be evaluated as False"](https://docwiki.embarcadero.com/RADStudio/Alexandria/en/IF_directive_(Delphi)). – Andreas Rejbrand Mar 16 '22 at 20:02
  • @AndreasRejbrand no, `RTLVersion111` is new in 11.1 (hence the 111 in its name). – Remy Lebeau Mar 16 '22 at 20:06
  • WARNING! you can not rely on RTLVersion111 because it's not consistent across delphi version. For exemple in sydney 10.4.2 you have RTLVersion1041 and RTLVersion1042 defined but not in Alexandria :( same for RTLVersion that is 35.00 in all version of alexandria (11.0, 11.1 and 11.2) – zeus Sep 08 '22 at 14:52
  • 1
    @zeus hence Dalija's comment that you would have to first look at `RTLVersion`, and then look at `RTLVersionXXX` for specific major releases. For instance, if ` RTLVersion` indicates 10.4.x, only look at `RTLVersion104x`. If `RTLVersion` indicates 11.x, only look at `RTLVersion11x`. And so on. – Remy Lebeau Feb 08 '23 at 03:11