delphidelphi-12-athenscompiler-version

What's the CompilerVersion for Delphi 12.1?


Delphi 12.1 just released and I'm checking the docs to try and see what the compiler version is so that I can add an if define for Delphi 12.1, but the docs haven't been updated for Delphi 12.1 yet.

How can I check what the CompilerVersion is for Delphi 12.1 or can someone tell me what it is?

The CompilerVersion for Delphi 12 is "36.0"


Solution

  • Compiler versions remain the same for major releases (with the exception of Delphi 2007 which had two compiler version, albeit for different platforms - one was for Win32 and another for long retired .NET compiler).

    So the compiler version for Delphi 12.1 is the same one as version for Delphi 12.0 - 36.0.

    If you look closely at the documentation link, you will see that only major releases are mentioned there, not the updates.

    What might be confusing is that at some point Delphi major version numbers contained a dot: Delphi 10.1 Berlin, Delphi 10.2 Tokyo, Delphi 10.3 Rio, and Delphi 10.4 Sydney. Update releases for those versions had two dots in the name: for instance Delphi 10.4.1 - for 10.4 Update 1.

    For Delphi 11 Alexandria and Delphi 12 Athens this dot notation for major versions was removed as it was too confusing and now number behind the first dot marks an update not the major version.

    However, Delphi 12.1 has another constant you can use for differentiating between 12.0 and update 12.1 which can be used in compiler defines for compile time version check.

    const
      RTLVersion121 = True;
    

    For runtime checking since Delphi 12.0 you can also use global function GetRtlVersion

    Returns the RTL version number of the system unit when it is compiled. The RTLVersion constant can be used for the expression in the conditional compilation. GetRTLVersion includes two bytes:

    • Upper byte: It holds the RTL major version.
    • Lower byte: It holds the RTL minor version. Usually, the minor version is the number of the update release. For example, for RAD Studio 12 - Update 1, GetRTLVersion would return $2401.