0
I have the following class
TClasse = class
public
Funcao: function(arg: String): Integer; stdcall;
end;
What happens is that when using RTTI in this class to return the "Function" function, it does not back because it is set to "nil", there is some way to return this function?
RTTI code:
function GetFunctionName(FuncPointer: Pointer):PAnsiChar;
type
PIInterface = ^IInterface;
var
obj: TObject;
Ctx: TRttiContext;
RttiType: TRttitype;
Method: TRttiMethod;
begin
obj := PIInterface(@FuncPointer)^ as TInterfacedObject;
RttiType := Ctx.GetType(obj.ClassType);
for method in RttiType.GetMethods do
begin
if method.CodeAddress = funcPointer then
result := PAnsiChar(method.name);
end;
end;
You can post the code (RTTI) that you are using to extract class functions?
– Andrey
@Andrey just updated
– William