Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə254/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   250   251   252   253   254   255   256   257   ...   294
DelphiLanguageGuide

Procedural Types
On the Win32 platform, a procedure pointer is stored as a 32-bit pointer to the entry point of a procedure or function.
A method pointer is stored as a 32-bit pointer to the entry point of a method, followed by a 32-bit pointer to an object.
On the .NET platform, procedural types are implemented using the System.MulticastDelegate class types.
Class Types
The following discussion of the internal layout of class types applies to the Win32 platform only. On the .NET platform,
class layout is determined at runtime. Runtime type information is obtained using the System.Reflection APIs in the .
NET framework.
On the Win32 platform, a class-type value is stored as a 32-bit pointer to an instance of the class, which is called
an object. The internal data format of an object resembles that of a record. The object's fields are stored in order of
declaration as a sequence of contiguous variables. Fields are always aligned, corresponding to an unpacked record
type. Any fields inherited from an ancestor class are stored before the new fields defined in the descendant class.
The first 4-byte field of every object is a pointer to the virtual method table (VMT) of the class. There is exactly one
VMT per class (not one per object); distinct class types, no matter how similar, never share a VMT. VMT's are built
automatically by the compiler, and are never directly manipulated by a program. Pointers to VMT's, which are
automatically stored by constructor methods in the objects they create, are also never directly manipulated by a
program.
The layout of a VMT is shown in the following table. At positive offsets, a VMT consists of a list of 32-bit method
pointersone per user-defined virtual method in the class typein order of declaration. Each slot contains the address
of the corresponding virtual method's entry point. This layout is compatible with a C++ v-table and with COM. At
negative offsets, a VMT contains a number of fields that are internal to Delphi's implementation. Applications should
use the methods defined in TObject to query this information, since the layout is likely to change in future
implementations of the Delphi language.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   250   251   252   253   254   255   256   257   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin