[fpc-pascal] Unable to compile JSON SuperObject on FPC 2.5.1

Michael Van Canneyt michael at freepascal.org
Wed Nov 10 11:57:52 CET 2010



On Wed, 10 Nov 2010, Fred Flinestone wrote:

> Hello all,
>
> I am not able to compile JSON – SuperObject where compiler says this:
>
> .../superobject.pas(135,18) Error: No matching implementation for
> interface method "IUnknown.QueryInterface(constref TGuid,out <Formal
> type>):LongInt; CDecl;" found
> .../superobject.pas(135,18) Error: No matching implementation for
> interface method "IUnknown._AddRef:LongInt; CDecl;" found
> .../superobject.pas(135,18) Error: No matching implementation for
> interface method "IUnknown._Release:LongInt; CDecl;" found
> 800 195.830/200.608 Kb Used
> .../superobject.pas(835,1) Fatal: There were 3 errors compiling module, stopping
>
> The definition of these function is:
>
>  TSuperObject = class(TObject, ISuperObject)
>    ...
>    function QueryInterface(const IID: TGUID; out Obj): HResult;
> virtual; stdcall;
>    function _AddRef: Integer; virtual; stdcall;
>    function _Release: Integer; virtual; stdcall;
>
> then I found that IUnknown has different declaration and therefore I
> made this correction:
>
>    function QueryInterface(const IID: TGUID; out Obj): LongInt; virtual; cdecl;
>    function _AddRef: LongInt; virtual; cdecl;
>    function _Release: LongInt; virtual; cdecl;
>
> not it stopped to write the error for _AddRef and _Release, but to
> QueryInterface is still the same error present.
>
> What could be a solution?

The declaration of the IUnknown has been changed on non-windows platforms
to be XP-COM compatible. You can copy the new definition from the system
unit, file rtl/inc/objpash.inc. It's just a matter of adding some ifdefs to
the declaration. The code inside should function OK.

Michael.


More information about the fpc-pascal mailing list