Class Reference Types On the Win32 platform, a class-reference value is stored as a 32-bit pointer to the virtual method table (VMT) of a
class.
On the .NET platform, class reference types are implemented using compiler-constructed nested classes inside the
class type they support. These implementation details are subject to change in future compiler releases.
Variant Types The following discussion of the internal layout of variant types applies to the Win32 platform only. On the .NET
platform, variants are an alias of System.Object. Variants rely on boxing and unboxing of data into an object wrapper,
as well as Delphi helper classes to implement the variant-related RTL functions.
On the Win32 platform, a variant is stored as a 16-byte record that contains a type code and a value (or a reference
to a value) of the type given by the code. The
System
and
Variants
units define constants and types for variants.
The TVarData type represents the internal structure of a Variant variable (on Windows, this is identical to the Variant
type used by COM and the Win32 API). The TVarData type can be used in typecasts of Variant variables to access
the internal structure of a variable.
The VType field of a TVarData record contains the type code of the variant in the lower twelve bits (the bits defined
by the varTypeMask constant). In addition, the varArray bit may be set to indicate that the variant is an array, and
the varByRef bit may be set to indicate that the variant contains a reference as opposed to a value.
The Reserved1, Reserved2, and Reserved3 fields of a TVarData record are unused.
The contents of the remaining eight bytes of a TVarData record depend on the VType field. If neither the varArray nor the varByRef bits are set, the variant contains a value of the given type.
If the varArray bit is set, the variant contains a pointer to a TVarArray structure that defines an array. The type of
each array element is given by the varTypeMask bits in the VType field.
If the varByRef bit is set, the variant contains a reference to a value of the type given by the varTypeMask and
varArray bits in the VType field.
The varString type code is private. Variants containing a varString value should never be passed to a non-Delphi
function. On Win32, Delphi's Automation support automatically converts varString variants to varOleStr variants
before passing them as parameters to external functions.
215