Delphi Considerations for Multi-Device Applications
Go Up to Considerations for Multi-Device Applications
Contents
- 1 The Extended Data Type is different on different platforms
- 2 The LongInt and LongWord Data Type are different on 64-bit POSIX platforms
- 3 Stack Alignment Issue on macOS
- 4 Migrating Delphi Applications from Win32 to macOS
- 5 Migrating Delphi Applications from Win32 to Win64
- 6 Migrating Delphi Applications from Win32 to Linux64
- 7 Migrating Delphi Applications from Desktop to Mobile
- 8 In the Clang-based C++ Compilers, 'absolute' Keyword is Not Supported in Interop between Delphi and C++Builder
- 9 Inline Assembly Limitations
- 10 See Also
The Extended Data Type is different on different platforms
The size of the Extended data type is different on each platform. Extended type is highest-precision floating-point type, and it is dependent on the runtime hardware.
- On Intel 32-bit Windows, the Extended type is (still) 10 bytes.
- On Intel 32-bit macOS or iOS-Simulator, the Extended type is (still) 16 bytes.
- On Intel Linux, the Extended type is (still) 16 bytes.
- On Intel 64-bit Windows, the Extended type is an alias for a Double, or 8 bytes.
- On ARM platforms include iOS and Android, the Extended type is an alias for a Double, or 8 bytes.
Thus you have less precision using an Extended data type on Win64 or ARM platforms compared to Win32. If your applications use the Extended data type and you rely on precision, such as for floating-point operations, this size difference might affect your data.
Very small or very large values are most affected. The precision of the two data types is as follows:
- 1x10308 IEEE Double, supported by 8-bytes Extended type include Intel 64-bit Windows and all ARM platforms
- 1x104932 IEEE Extended, supported by 10 or 16 bytes Extended type include Intel POSIX platforms
If your code base contains the Extended data type, you will receive the hint message: W1066 Lost Extended floating point precision. Reduced to Double (Delphi). 10-bytes Extended precision floating-point operations are supported in the Intel 32-bit Windows applications and not supported in Intel 64-bit Windows applications. On Intel 64-bit Windows, the precision of floating-point operations with Extended variables is reduced to double precision.
The TExtended80Rec record can be used to work with extended precision floating-point variables on all platforms, but only to read or write to and from the memory and to perform low-level changes (modifying the mantissa, exponent, or sign).
For more information about 64-bit data types, see 64-bit Windows Data Types Compared to 32-bit Windows Data Types.
The LongInt and LongWord Data Type are different on 64-bit POSIX platforms
To keep interoperability between Delphi and POSIX API, for 64-bit POSIX platforms, the size of LongInt and LongWord types are changed to 64-bit. All 32-bit platforms and 64-bit Windows platforms keep 32-bit for the LongInt and LongWord types.
Stack Alignment Issue on macOS
For macOS applications, one big issue is the requirement that all memory data be stack-aligned on 16-byte boundaries:
- For details, see Eli Boling's blog: http://blogs.embarcadero.com/eboling/2009/05/20/5607.
- For Delphi applications, you can use the Code align (Delphi) directive to set 16-byte boundaries.
- Also see the ALIGN_STACK Define in Conditional compilation (Delphi).
Migrating Delphi Applications from Win32 to macOS
The following table summarizes the platform support by the various libraries in RAD Studio:
Library\Platform | Win32 | Win64 | macOS 32-bit | macOS 64-bit |
---|---|---|---|---|
FMX |
![]() |
![]() |
![]() |
![]() |
RTL |
![]() |
![]() |
![]() |
![]() |
VCL |
![]() |
![]() |
Not supported |
Not supported |
Some exceptions do exist in RTL and VCL support for specific platforms. For example, BDE is not supported on either Win64 or macOS.
The VCL is Windows-only, and does not support macOS. Applications that target macOS should be built with FireMonkey (FMX).
The majority of the Delphi Run-Time Library (RTL), on the other hand, supports all the Supported Target Platforms. The RTL contains the System, SysUtils, and IOUtils units, and others, which contain platform-neutral elements.
- Delphi applications that use only the RTL (not the VCL) work on macOS 32-bit (and Win64) with few changes.
- Any Delphi application that uses the VCL and/or the RTL supports both Win32 and Win64.
For more information about the RTL, see Using the RTL (Run-Time Library).
For more information about FireMonkey, see FireMonkey.
For More Information about the VCL, see Introducing the Visual Component Library (VCL).
Migrating Delphi Applications from Win32 to Win64
The VCL, FMX and the RTL are supported on both Win32 and Win64.
For Delphi Win64 application development, see 64-bit Windows Application Development.
Migrating Delphi Applications from Win32 to Linux64
The VCL and the FMX are not supported on Linux platforms. At this point, Linux supports console applications only.
For Delphi Linux Application Development, see Linux Application Development.
Migrating Delphi Applications from Desktop to Mobile
In the Clang-based C++ Compilers, 'absolute' Keyword is Not Supported in Interop between Delphi and C++Builder
If you want to write Delphi code that runs interop with the Clang-enhanced C++ Compilers, you cannot use the "absolute" Delphi directive/keyword in the interface section of a Delphi app when running interop with any of the Clang-enhanced C++ Compilers. However, you can use the "absolute" keyword in the implementation section.
LLVM does not offer the mechanism for a variable to overlay on another, so C++Builder assumes a unique symbol for each variable.
Inline Assembly Limitations
If your code base contains inline assembly code, you might need to make code changes in order to move to new platforms. For more information, see the following topics:
For Intel 64-bit Windows platforms
For ARM platforms and Intel Linux platforms
The platforms do not support inline-assembler.