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

Michael Van Canneyt michael at freepascal.org
Sun Aug 29 16:54:57 CEST 2010



On Sun, 29 Aug 2010, Marco van de Voort wrote:

> In our previous episode, Michael Van Canneyt said:
>> Because if it is something we decided, it simply means that we should change
>> it's meaning to be identical to mwpascal: cdecl calling convention, and const
>> structs passed by reference. If I'm right, 'stdcall' currently
>> has no meaning on non-windows platforms other than the one we put on it.
>
> mwpascal is still per declaration and Delphi incompatible. And keep in mind
> that any implementation of a IUnknown must repeat any modifiers in the
> original source (including const ref and calling conventions) regardless of
> what option is chosen.

I meant people write 'stdcall', but the same semantics as 'mwpascal' are used 
by the compiler, since stdcall is a windows calling convention construct, invented 
only by Microsoft for backwards compatibility with early versions of Windows.
(to my knowledge, that is)

_if_ stdcall is not used by any compiler on non-windows, then we can assign 
whatever meaning to it that we please, which would in this case be the same 
meaning as mwpascal.

But I still fail to see why Joost needs all this.

His change would mean that the GCC compiler does things which we currently 
know nothing about, namely it pushes const parameters by reference in some 
cases. In casu: What is the C declaration for the QueryInterface call ?

It is defined in FPC as:
function QueryInterface(const iid : tguid;out obj) : longint;stdcall;

But what is QueryInterface as defined in C ? Does C have a tguid type ?

These questions should be answered prior to changing anything in the compiler.

Michael.



More information about the fpc-devel mailing list