[fpc-devel] Passing parameters through the stack to interfaces

Sergei Gorelkin sergei_gorelkin at mail.ru
Thu Aug 5 15:36:31 CEST 2010


Joost van der Sluis пишет:
> ...
> I don't know what's the best way to fix this.
> 
> I see three solutions:
> 
> 1: replace the 'call' in the wrapper with a 'jmp'. I've tried this and
> it works, but when the function returns, the 'self'-class-pointer is not
> converted to the interface-pointer. But I don't see why this is done in
> the first place?!? Other problem is that you get a somewhat strange
> function-name in your stacktrace. (the name of the wrapper)
> 
I just tested, Delphi does it this way.

> 2: See if we can let the caller do the
> interface-pointer-to-class-pointer conversion. That way the wrapper is
> not necessary anymore. Leads to somewhat faster code, though less
> compact. But this is only possible if the caller has enough information
> to do the conversion. I'm not sure if that's the case.
> 
Unfortunately, the caller cannot make any assumptions about the implementor's
internal structure. The callee side may as well be a non-Pascal code.

Regards,
Sergei




More information about the fpc-devel mailing list