RTTI not returning function in getMethods

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 come back because it is set to "nil", is there any 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;
    
asked by anonymous 10.03.2017 / 14:31

0 answers