[Lazarus] Breaking change

Michael Van Canneyt michael at freepascal.org
Sun Jul 23 15:19:53 CEST 2017

On Sun, 23 Jul 2017, Martok via Lazarus wrote:

> Am 23.07.2017 um 14:24 schrieb Michael Van Canneyt via Lazarus:
>>> The pointer-ness of REFIID is an artefact of the C-ABI. It is not meant to mean
>>> 'pass a pointer to a GUID-struct', but 'pass a GUID using byref'. We have
>>> constref for that.
>> See the link to the Windows MSDN.
> Yes, so?

Well, if they declare it as a pointer, why should I not do the same :) ?

> REFIID is also the type of the first argument of QueryInterface.
> <https://msdn.microsoft.com/en-us/library/windows/desktop/ms682521%28v=vs.85%29.aspx>

I know.

>    { IUnknown }
>    function QueryInterface({$IFDEF
> FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): Hresult;
> virtual; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};

That is a historical monstrosity :)

> But I see already it has been translated differently in every unit (mostly
> because MS made it uniform only after the headers were translated), so might as
> well use the new one to keep things interesting. Carry on.

I agree the matter is a bit dubious :/

But, before doing anything, I looked around. Saw some C# and VB import 
statements. Noticed even in Delphi it's not 100% clear (see winrt* units), 
and finally decided to do it like this to make people aware of the fact 
that if they used a refiid argument in the past, it can hardly have worked.
The current definition makes it quite clear that it is in fact a pointer to a GUID.


More information about the Lazarus mailing list