TInterfaceEntry Type
type TInterfaceEntry = packed record IID: TGUID; VTable: Pointer; IOffset: Integer; ImplGetter: Integer; end;
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.
An object can implement an interface using a property (with the
implements
directive). The property is implemented
with a field or method reference, which is stored in the
ImplGetter
member 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 and ImplGetter
is 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 VTable
field. The
compiler also generates a hidden field to store the interface. The
field’s offset in the object is IOffset
.
When you create a new object, Delphi automatically initializes the
hidden interface fields.
See the TObject
type and its
GetInterfaceTable
and
GetInterface
methods to see how Delphi looks up
interfaces.