RAD Studio for Microsoft .NET
ContentsIndex
PreviousUpNext
Changes Required Due to 64-bit .NET 2.0 Support

Changes were made to support 64-bit .NET 2.0. These changes might require minor code changes so that existing applications work correctly. See Making Changes Required Due to 64-bit .NET 2.0 Support for detailed information on specific changes required.

This document describes changes that might be required to existing VCL.NET applications to function correctly with the changes made to support 64-bit .NET 2.0.  

To provide single source, single executable support for both 32 and 64-bit platforms, handle types have been changed from LongWord to IntPtr. IntPtr is an integer type the size of a pointer on the underlying platform, which is implemented as a structure in .NET. It doesn't support the assignment, comparison and arithmetic operations commonly performed on handles in the VCL. To supply backwards compatibility, a record helper has been created to support commonly used operations through operator overloading. 

Most code does not need modification to continue running on both x86 and x64 platforms, but there are some cases that require minor changes.

Warning: These changes are required due to changes made to support 64-bit systems. They must be made for applications intended for both 32-bit and 64-bit systems.

Code patterns may need to change in the following areas:

  • Case statements
  • Casting enumerations
  • Using handles with sets
  • Indexing into arrays
  • Assuming a specific handle size
  • Casting enumerations

A number of declarations have been changed to properly support single executables for both x86 and x64 platforms. In most of these cases, the type of a function’s parameter or a structure’s field has been changed, and the compiler provides information to easily fix affected code. Changes where the fix is less obvious include type changes to callback functions and modifications to variant records. In these cases, a list of the affected callbacks and records has been provided in Making Changes Required Due to 64-bit .NET 2.0 Support.

Modified Callbacks

A few callbacks have changed parameters, so each of their occurrences needs to be modified.

Modified Variant Records

Variant records are implemented in Delphi.NET as records with explicit field layouts (as opposed to sequential layouts, which is the .NET Framework default). This allows multiple fields to be “overlayed” at the same field offset, which results in incorrect declarations when running on 64-bit platforms when the structure contains any variable size field (such as IntPtr). Variant records with such fields have been modified to contain only one of the “variant” cases. The remaining fields have been changed to properties to provide backwards compatibility. In most cases, source code is not affected by these changes. However, passing a field as a var parameter that is now declared as a property does require a code change.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!