
I was looking through the “What’s New in version 11 Alexandria” and found a cool tidbit about small changes in the RTL for “Platform Identifiers“. Using these platform identifiers can help in your cross platform development projects. Ensuring that all of the platform related identifiers use a consistent naming pattern will also help in your programming efforts.
You will find the new platform identifiers in the System.Classes.pas and System.Classes.hpp files. Note: a few of the platform identifiers are now marked with the deprecated attribute.
C++Builder note: In the screen grab above, I used the “Classic” C++ compiler to display the deprecated warning message in the Message Window. In the DocWiki there is a note about workarounds in using the Clang-enhanced compilers and deprecated attributes. The DocWiki entry says to “use #pragma obsolete as a workaround for the deprecated attribute.”
Interested in using Embarcadero’s IDE Software? It will help you Build Apps 5x Faster With One Codebase for Windows, Android, iOS, macOS, and Linux. Request a free trial here.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition
This sounds really useful but I’m having some trouble with documentation.
I can find the definitions in System.Classes.pas (Delphi), but in the same unit I see use of
$IFDEF MSWINDOWS
$IFDEF ANDROID
and so on.
Can you point to some additional discussion?
These kind of compiler directives (as they are called) allow you to have blocks of code which will only get compiled into your apps if they evaluate to true.
So, for example:
{$IDEF ANDROID}
// Do something here which you only want to execute when the program is compiled for an Android device...
{$ENDIF}
The full set of directives which you can use can be found here: https://docwiki.embarcadero.com/RADStudio/Sydney/en/Conditional_compilation_(Delphi)