System.Rtti.Invoke
Delphi
function Invoke(CodeAddress: Pointer; const Args: TArray<TValue>;
CallingConvention: TCallConv; AResultType: PTypeInfo; IsStatic: Boolean; IsConstructor: Boolean): TValue;
C++
extern DELPHI_PACKAGE TValue __fastcall Invoke(void * CodeAddress, const System::DynamicArray<TValue> Args, System::Typinfo::TCallConv CallingConvention, System::Typinfo::PTypeInfo AResultType, bool IsStatic = false, bool IsConstructor = false);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Rtti.pas System.Rtti.hpp |
System.Rtti | System.Rtti |
Description
Dynamically invokes a method.
Use Invoke to invoke a method at run time. Invoke is useful when the actual method is not known at compile time, but is rather looked up at run time.
The following table lists the parameters of the Invoke routine.
Parameter | Description |
---|---|
CodeAddress |
The address of the method to invoke. |
Args |
An array of TValue records, each storing a parameter passed to the method. |
CallingConvention |
The calling convention used to invoke the method. |
AResultType |
The type information of the method result type. |
Invoke returns a TValue record that holds the result of the invoked method.
Depending on the type of the invoked method, the Args array must follow a set of rules:
- For instance methods, the first element in the Args array must be the pointer to the instance.
- For interface methods, the first element in the Args array must be the interface reference.
- For class methods, the first element in the Args array must be the a class reference.
- Static methods and global routines do not require any special treatment.