Hello, I need to call a method dynamically by its name over string and pass some parameters to it. OK, I don't know if it is possibly in the current version of the compiler, but I'm trying to do something like this:
TMethodInvoker.Invoke(VMyObj, ['Param 1', 'Param 2', 1, True]); I already get some paramerter informations using this code[1], that prints all parameters and its types using RTTI. So I have a question: how can I get the method typedata looking for it in the VMT? Please see this: WriteLn(HexStr(@TMyObject.Test)); WriteLn(HexStr(TMyObject.MethodAddress('Test'))); Prints the same address. But: TI := TypeInfo(@TMyObject.Test); WriteLn(HexStr(TI)); TI := TypeInfo(TMyObject.MethodAddress('Test')); WriteLn(HexStr(TI)); Prints different results. How System.TypeInfo retrieve the typeinfo from my @TMyObject.Test address? It is done by the method address so? I took a look at the TRTTIWriter class and also in the VMT, but I don't know how the compiler handles this informations internally, so sorry it this question sounds nonsense. =P [1] - http://pastebin.com/bPascrwe -- Silvio Clécio My public projects - github.com/silvioprog
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal