[fpc-devel] constref in Windows

Marcos Douglas md at delfire.net
Fri Nov 19 13:12:17 CET 2010


On Fri, Nov 19, 2010 at 8:39 AM, José Mejuto <joshyfun at gmail.com> wrote:
> Hello FPC,
>
> In fpc 2.5.1 trunk today the QueryInterface in rtl\inc\objpash.inc is
> defined as:
>
> IUnknown = interface
>  ['{00000000-0000-0000-C000-000000000046}']
>  function QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} iid : tguid;out obj) : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
>  function _AddRef : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
>  function _Release : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
> end;
> IInterface = IUnknown;
>
> Which after the resolved ifdefs it is compiled in Windows as:
>
> IUnknown = interface
>  ['{00000000-0000-0000-C000-000000000046}']
>  function QueryInterface(constref iid : tguid;out obj) : longint; stdcall;
>  function _AddRef : longint; stdcall;
>  function _Release : longint; stdcall;
> end;
> IInterface = IUnknown;
>
> Which breaks the compilation of source code like Zeos which expect the
> "iid: tguid" to be const, not constref.
>
> I'm aware about the changes done to be XPCOM compatible, but at the
> price of "breaking" all existing COM code ? OK, the break is quite
> easy to solve, just replace const by contref, but the question is...
> Is needed to change it to constref in Windows platform too ?
>
> I know Joost do the changes, but I think direct email is not a good
> choice unless no answer in list of course.

See http://zeos.firmos.at/viewtopic.php?p=12307&sid=0ac36e5e5c88d2e740abd551df7b4699#12307

Marcos Douglas



More information about the fpc-devel mailing list