Delphi Considerations for Multi-Device Applications
Go Up to Considerations for Multi-Device Applications
Contents
- 1 The Extended Data Type Is 2 Bytes Smaller on 64-bit Windows Systems
- 2 Stack Alignment Issue on OS X
- 3 Migrating Delphi Applications from Win32 to OS X
- 4 Migrating Delphi Applications from Win32 to Win64
- 5 Migrating Delphi Applications from Desktop to Mobile
- 6 In Win64, 'absolute' Keyword is Not Supported in Interop between Delphi and C++Builder
- 7 Inline Assembly Limitations on 64-bit Windows
- 8 See Also
The Extended Data Type Is 2 Bytes Smaller on 64-bit Windows Systems
The size of the Extended data type is different on Win64 and on Win32:
- On Win64, the Extended type is an alias for a Double, or 8 bytes.
- On Win32, the Extended type is (still) 10 bytes.
Thus you have less precision using an Extended data type on Win64 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 Win64
- 1x104932 IEEE Extended, supported by Win32
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). Extended precision floating-point operations are supported in the 32-bit applications and not supported in 64-bit applications. On Win64 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, 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.
Stack Alignment Issue on OS X
For OS X 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 OS X
The following table summarizes the platform support by the various libraries in RAD Studio:
Library\Platform | Win32 | Win64 | Mac OS X |
---|---|---|---|
FMX |
Yes |
Yes |
Yes |
RTL |
Yes |
Yes |
Yes |
VCL |
Yes |
Yes |
Not supported |
Note: The table above is only a high-level representation of library support for platforms. Some exceptions do exist in RTL and VCL support for specific platforms. For example, BDE is not supported on either Win64 or Mac OS X.
The VCL is Windows-only, and does not support OS X. Applications that target OS X 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 OS X (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 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 Desktop to Mobile
- Migrating Delphi Code to Mobile from Desktop
- Automatic Reference Counting in Delphi Mobile Compilers
In Win64, '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 on 64-bit Windows
If your code base contains inline assembly code, you might need to make code changes in order to move to 64-bit. For more information, see the following topics: