[Home] [Puzzles & Projects] [Delphi Techniques] [Math Topics] [Library] [Utilities]
Borland (now CodeGear) defines unique conditional symbols for each version of Delphi which can be tested at compile time. The problem is, it's not easy to find out what the values are. Here's a table:
Why do we care? Once in a while we need to change the source code based on the version of Delphi being used. Conditional test $IFDEF will let us accomplish this. For example, Delphi 6 needs a windowed control's DoubleBuffered property to be turned on to prevent flickering when a TImage is redrawn. This is not necessary in Delphi 5 (I suspect a D5 "bug" that is "corrected" in D6.) Here's sample code from of a program currently being developed which fixes some TTabsheets to make things right regardless of the compiler version used.
Addendum January 23, 2008: I recently started looking into switching from Delphi Version 5 to a free product, Turbo Delphi Explorer, which is Delphi 2006 with some modest restrictions. I needed to use the conditional version tests to help account for some of the differences when compiling existing programs and perhaps to maintain compatibility in the future.
I found this "wikia page" with a complete listing of compiler conditional defines for Delphi: http://delphi.wikia.com/wiki/Borland_Compiler_Conditional_Defines so thought I record it here for future reference.
Copyright © 2000-2013, Gary Darby
All rights reserved.