Title
I am trying to invoke a method using RTTI calls but I been struggling to do so
Here is my sample code
{$RTTI METHODS([vcPublic, vcProtected, vcPrivate])}
TBill = class sealed
private
Procedure Extract ;
procedure Tansform
Procedure Load;
public
constructor create (aFlagDb : Boolean); overload;
Procedure InvokeMethod(aMethodName: string; const Args: array of TValue);
end
procedure InvokeMethod(aMethodName: string; const Args: array of TValue);
var
Method :TRttiMethod;
rtype :TRTTIType;
begin
rtype := TRTTIContext.Create.GetType('TBill');
Method := rtype.GetMethod('Extract'); -> Returns Nil why?
Method.Invoke(self, Args);
end
Any Ideas?
Hi Alexander sorry thats what i typed
ReplyDeletertype := TRTTIContext.Create.GetType(TBill);
I even tried
Method := rtype.GetMethod('procedure Extract') but still same result
Why you don't provide real code?
ReplyDeleteThe problem I think is
{$RTTI EXPLICIT METHODS([vcPublic, vcProtected, vcPrivate])}
Hi Alexander,
ReplyDeleteI found the problem i need to specify
{$RTTI INHERIT METHODS([vcPublic, vcPublished, vcPrivate, vcProtected]) }
instead of
I found the problem i need to specify
{$RTTI I METHODS([vcPublic, vcPublished, vcPrivate, vcProtected]) }