[fpc-devel] QueryInterface on linux/i386 - adding 'in' parameter type?

Michael Van Canneyt michael at freepascal.org
Mon Aug 30 20:14:33 CEST 2010



On Mon, 30 Aug 2010, Joost van der Sluis wrote:

>> for possibly thousands of arguments in an interface description is simply not
>> an option.
>
> There is no need to add an {$ifdef windows} to the definition of
> QueryInterface. Because on windows/stdcall record-parameters with a
> size>pointersize are already passed by value. (Borland did this probably
> just for this case) So when we use 'constref' effectively nothing
> changes on Windows.
>
> The problem with the {$ifdef}'s does only exist for other header
> conversions. (For example the Gecko headers)
>
> And Michael, this is all important for Gecko because all objects are
> passed as interfaces. And Gecko uses QueryInterface to 'cast' one
> interface to the other, so QueryInterface is called by Gecko a lot. Then
> these calls have to be binary compatible.
>
> Changing the definition of QueryInterface to something completely
> different is also hard, because now you can do:
>  Object.QueryInterface(IInterface, AInterfaceInstance);
> This is used a lot...
>
> Conclusion(?)
>
> I think that adding 'constref' is the best way to go. It's more
> 'pascalish', imho. And it has a clear meaning and use, namely converting
> 'typename const *' definitions from C-headers.

Like I wrote in my last reply to Jonas: I agree that this is the best way to go.

It just means that the gecko interface will need some {$ifdefs} because Delphi
does not support constref.

Michael.



More information about the fpc-devel mailing list