Name
TInterfaceEntry Type
Syntax
type
TInterfaceEntry = packed record
IID: TGUID;
VTable: Pointer;
IOffset: Integer;
ImplGetter: Integer;
end;Description
Every class that implements one or more interfaces has a table of
interface entries in its RTTI. The TInterfaceEntry
record stores the necessary information for the interface. See Chapter 3 for more information about RTTI.
Tips and Tricks
An object can implement an interface using a property (with the
implementsdirective). The property is implemented with a field or method reference, which is stored in theImplGettermember as the field offset, virtual method offset, or static method pointer. Usually, the class implements the interface by implementing all the methods of the interface andImplGetteris zero.If the class implements the interface directly, the compiler generates a virtual method table for the interface and stores a pointer to the vtable in the
VTablefield. The compiler also generates a hidden field to store the interface. The field’s offset in the object isIOffset. When you create a new object, Delphi automatically initializes the hidden interface fields.See the
TObjecttype and itsGetInterfaceTableandGetInterfacemethods to see how Delphi looks up interfaces.
See Also
| Implements Directive, Interface Keyword, PInterfaceEntry Type, Property Keyword, TGUID Type, TInterfaceTable Type, TObject Type |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access