Jump to content
Ian Branch

Retrieve Delphi version used from within an App?

Recommended Posts

Hi Team,

Is there a way to retrieve the Delphi version used to build an app, from within the app at run time??

 

Regards & TIA,

Ian

Share this post


Link to post

To a certain extent, you may use the predefined symbols. See the documentation here and here.

Using conditional compilation, you can generate a string with a pretty name for Delphi version.

Share this post


Link to post

MadExcept includes the name of the Delphi compiler in their reports. I checked their code, they use a defines to get to the name of the compiler:

 

{$ifdef ver340}
// 'compiled with', 'Delphi 10.4 Sydney'
{$endif}

Share this post


Link to post

Hi Guys,

Thank you.  I really had expected EMB to have slipped it in there somewhere.

 

Regards,

Ian

Share this post


Link to post

There are the CompilerVersion and RtlVersion constants, but they are not the values you would want to display.

Share this post


Link to post
// Compiler version constants for checking with CompilerVersion constant
const
  RAD_Sydney  = 34; RAD_10_4 = 34;
  RAD_Rio     = 33; RAD_10_3 = 33;
  RAD_Tokyo   = 32; RAD_10_2 = 32;
  RAD_Berlin  = 31; RAD_10_1 = 31;
  RAD_Seattle = 30; RAD_10 = 30;
  RAD_XE8  = 29;
  RAD_XE7  = 28;
  RAD_XE6  = 27;
  RAD_XE5  = 26;
  RAD_XE4  = 25;
  RAD_XE3  = 24;
  RAD_XE2  = 23;
  RAD_XE   = 22;
  RAD_2010 = 21;
  RAD_2009 = 20;
  RAD_2007 = 19;
  RAD_2006 = 18;
  RAD_2005 = 17;
  Delphi_8 = 16;
  Delphi_7 = 15;

 

Share this post


Link to post
43 minutes ago, Fr0sT.Brutal said:

// Compiler version constants for checking with CompilerVersion constant
const
  RAD_Sydney  = 34; RAD_10_4 = 34;
  RAD_Rio     = 33; RAD_10_3 = 33;
  RAD_Tokyo   = 32; RAD_10_2 = 32;
  RAD_Berlin  = 31; RAD_10_1 = 31;
  RAD_Seattle = 30; RAD_10 = 30;
  RAD_XE8  = 29;
  RAD_XE7  = 28;
  RAD_XE6  = 27;
  RAD_XE5  = 26;
  RAD_XE4  = 25;
  RAD_XE3  = 24;
  RAD_XE2  = 23;
  RAD_XE   = 22;
  RAD_2010 = 21;
  RAD_2009 = 20;
  RAD_2007 = 19;
  RAD_2006 = 18;
  RAD_2005 = 17;
  Delphi_8 = 16;
  Delphi_7 = 15;

 

The constant also exists in Delphi 6, value is 14. Older versions don't have it.

Share this post


Link to post
3 minutes ago, dummzeuch said:

The constant also exists in Delphi 6, value is 14. Older versions don't have it.

Nice to know, thanks! I support D7+ only though 🙂

Share this post


Link to post

ICS has an include file which define a specific symbol for each Delphi version from D1 to D10.4. The symbol are named after the highest version number you can find in the IDE about box. For example in D10.4.2, you can read "Embarcadero® Delphi 10.4 Version 27.0.40680.4203" in the about box and DELPHI27 symbol is defined. There are also symbols like DELPHI15_UP for Delphi Version 15.X.Y.Z aka Delphi XE and up. This symbol allow conditional compile for code containing feature introduced in the language at a specific version.

 

There are also similar symbols for C++ Builder and for the compiler itself. Read the file...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×