Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-11

Unable to compile JSON SuperObject on FPC 2.5.1

6 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Fred Flinestone

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?

Thanks in advance.

Fred.

Michael Van Canneyt
to Fred Flinestone: I am not able to compile JSON – SuperObject where compiler says this:…
Fred Flinestone wrote 34 lines
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.

Fred Flinestone
to Jonas Maebe: http://wiki.freepascal.org/User_Changes_Trunk#IInterface.QueryInterface.2C_._AddRef_and_._…

Thanks.

Jonas Maebe wrote 16 lines
On 10 Nov 2010, at 11:48, Fred Flinestone wrote: > 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? http://wiki.freepascal.org/User_Changes_Trunk#IInterface.QueryInterface.2C_._AddRef_and_._Release_definitions_have_been_changed Jonas _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal
José Mejuto
to Michael Van Canneyt: The declaration of the IUnknown has been changed on non-windows platforms to be XP-COM…

Hello FPC-Pascal,

you wrote
> function QueryInterface(const IID: TGUID; out Obj): HResult; > virtual; stdcall;

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

But also in Windows, QueryInterface has been changed to constref, so something like Zeos 6.6 needs an adjust before compile succesfully. Is this expected ?

Best regards, José
Michael Van Canneyt
to José Mejuto
José Mejuto wrote 14 lines
Hello FPC-Pascal, Wednesday, November 10, 2010, 11:57:52 AM, you wrote: >> function QueryInterface(const IID: TGUID; out Obj): HResult; >> virtual; stdcall; MVC> The declaration of the IUnknown has been changed on non-windows platforms MVC> to be XP-COM compatible. You can copy the new definition from the system MVC> unit, file rtl/inc/objpash.inc. It's just a matter of adding some ifdefs to MVC> the declaration. The code inside should function OK. But also in Windows, QueryInterface has been changed to constref, so something like Zeos 6.6 needs an adjust before compile succesfully. Is this expected ?

I don't think so, this should be asked to Joost van der sluis.

Michael.