Built-in macros: $platform

The $platform macro is replaced by the full name of the Platform Package selected in the profile the code is currently compiled for. The value of this macro corresponds thus to the value of this profile's attribute PlatformPackage.

Content

name.name. ... .name

Discussion

The Platform Package name is composed of identifiers separated by . (dot) signs. The individual identifiers determine the manufacturer of the target system, the target CPU/MCU architecture or the version of the operating system as well as the color format used in the target system. Following is an example of Platform Package name identifying Apple's iOS target using the 32-Bit RGBA color space:

Apple.iOS.RGBA8888

This macro can be used to conditionally compile the application. For example, if you want a code section to be executed only when the application is compiled for the Apple iOS device, you can implement following code at the appropriate location within your component:

$if $platform == Apple.iOS.RGBA8888 SomeTextView.String = "Running on Apple iOS device!"; SomeObject.PerformSomeOperation(); $endif

When compiling the application for another Platform Package (e.g. Tara.Win32.RGBA8888), the above code section is simply ignored. You can also use the macro inside a string literal to format e.g. a trace debug message:

trace "Initializing for the platform package version $platform ...";