Published methods don't have type information for their arguments in the RTTI
Original Reporter info from Mantis: Hixie
-
Reporter name: Ian Hickson
Original Reporter info from Mantis: Hixie
- Reporter name: Ian Hickson
Description:
I have a strange case where I need to make a decision based on the arguments that a published method has.
If I have a A, a pointer to an object (instance of a type derived from TObject), and B, a pointer to a published method of that object, and that object or one of its ancestors was compiled with $M+, I can get the method's name using TObject(A).MethodName(B), but there does not seem to be any way to get the method's arguments' TTypeInfo records.
Some versions of Delphi [1] encoded the parameters of stdcall methods in the VMT published method table. It would be great to do something similar. Noet that the RTTI system already has a way to describe methods in general, which is used for method properties, it's just not used to described published methods themselves.
[1] http://hallvards.blogspot.com/2006/05/under-hood-of-published-methods.html — search for "page 74"
(The ugly workaround today is to declare a property per method, assign the method to the property, and then walk the properties looking for one that references the method with address B, using the matching property's method data rather than the method's own data. But that's pretty horrific.)
Mantis conversion info:
- Mantis ID: 24516
- Monitored by: » Hixie (Ian Hickson), » @m-fuchs (Michael Fuchs)