[fpc-devel] RTTI method paramlist broken?

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Sep 12 12:44:37 CEST 2009


On Sat, 12 Sep 2009 12:14:07 +0200
Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:

> 
> On 12 Sep 2009, at 12:02, Mattias Gaertner wrote:
> 
> > On Sat, 12 Sep 2009 11:54:04 +0200
> > Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
> >
> >> Previously, the order was reversed for non-i386 platforms depending
> >> on the calling convention. Now it should always be correct, both
> >> for i386 and for other architectures. Or do you mean that you now
> >> won't reverse the order anymore for non-i386?
> >
> > Where is the calling convention in the RTTI stored?
> 
> I don't think it is stored anywhere (does Delphi specify whether
> e.g. register or stdcall is used?). But you shouldn't need it for
> the parameter order, because depending on whether the calling
> convention specifies left-to-right or right-to-left pushing, the
> order of the parameters in the rtti also changes. That's why
> tests/webtbs/ tw12038.pp contains stdcall for all methods, because
> otherwise I can't use constant strings to check the results (since on
> i386, the default calling convention pushes from left to right
> instead of from right to left). This is at least Kylix-compatible.
> 
> Of course, the parameter order by itself is not enough to use this  
> information to call anything, since it does specify how the
> parameters have to be passed (in registers, on the stack, whether the
> callee or caller is responsible to clean up the stack, ...).
> 
> Or do you use this information only for display or code completion  
> purposes (so you always want the parameters in left-to-right order)?  
> In that case, I don't think that's possible with rtti.

Yes, I need this to find compatible methods.
But RTTI lacks unitnames too. So this is just another reason to
avoid using RTTI. Eventually I will replace that code in lazarus. 

Mattias



More information about the fpc-devel mailing list