Ubuntu Lazarus can't compile predefined class with IUnknown interface lazarus / 1-Linux ---------------------------------------------------------------------- dmitryb · 2018-09-05 17:14 Hi All I have next code example Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit2; //{$mode objfpc}{$H+}{$MODE Delphi}//{$H+}  interface uses  Classes, SysUtils; type  TEditButtonEh = class; { TEditButtonEh }   TEditButtonEh = class(TCollectionItem {$IFNDEF CIL}, IUnknown {$ENDIF})  private  protected    { IInterface }  {$IFDEF FPC}    function QueryInterface(constref IID: TGUID; out Obj): HResult; virtual; stdcall;  {$ELSE}    function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall;  {$ENDIF}    function _AddRef: Integer; stdcall;    function _Release: Integer; stdcall;  end;  implementation {$IFDEF FPC}function TEditButtonEh.QueryInterface(constref IID: TGUID; out Obj): HResult;{$ELSE}function TEditButtonEh.QueryInterface(const IID: TGUID; out Obj): HResult;{$ENDIF}begin  if GetInterface(IID, Obj)    then Result := 0    else Result := E_NOINTERFACE;end; function TEditButtonEh._AddRef: Integer;begin  Result := -1;end; function TEditButtonEh._Release: Integer;begin  Result := -1;end; end.  Lazarus.Win32 1.8.4 compile this unit without error. Lazarus.Ubuntu  raise next errors Compile Project, Target: project1: Exit code 256, Errors: 3 unit2.pas(13,19) Error: No matching implementation for interface method "QueryInterface(constref TGuid;out ):LongInt; CDecl;" found unit2.pas(13,19) Error: No matching implementation for interface method "_AddRef:LongInt; CDecl;" found unit2.pas(13,19) Error: No matching implementation for interface method "_Release:LongInt; CDecl;" found I can't understand is this a feature or bug. I need to have a "forward class declaration" in my big real unit. ---------------------------------------------------------------------- taazz · 2018-09-05 17:47 Quote from: dmitryb on September 05, 2018, 07:14:30 pmHi All I have next code example Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit2; //{$mode objfpc}{$H+}{$MODE Delphi}//{$H+}  interface uses  Classes, SysUtils; type  TEditButtonEh = class; { TEditButtonEh }   TEditButtonEh = class(TCollectionItem {$IFNDEF CIL}, IUnknown {$ENDIF})  private  protected    { IInterface }  {$IFDEF FPC}    function QueryInterface(constref IID: TGUID; out Obj): HResult; virtual; stdcall;  {$ELSE}    function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall;  {$ENDIF}    function _AddRef: Integer; stdcall;    function _Release: Integer; stdcall;  end;  implementation {$IFDEF FPC}function TEditButtonEh.QueryInterface(constref IID: TGUID; out Obj): HResult;{$ELSE}function TEditButtonEh.QueryInterface(const IID: TGUID; out Obj): HResult;{$ENDIF}begin  if GetInterface(IID, Obj)    then Result := 0    else Result := E_NOINTERFACE;end; function TEditButtonEh._AddRef: Integer;begin  Result := -1;end; function TEditButtonEh._Release: Integer;begin  Result := -1;end; end.  Lazarus.Win32 1.8.4 compile this unit without error. Lazarus.Ubuntu  raise next errors Compile Project, Target: project1: Exit code 256, Errors: 3 unit2.pas(13,19) Error: No matching implementation for interface method "QueryInterface(constref TGuid;out ):LongInt; CDecl;" found unit2.pas(13,19) Error: No matching implementation for interface method "_AddRef:LongInt; CDecl;" found unit2.pas(13,19) Error: No matching implementation for interface method "_Release:LongInt; CDecl;" found emphasis is mine the changes bellow should solve the posted errors. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit2;  TEditButtonEh = class(TCollectionItem {$IFNDEF CIL}, IUnknown {$ENDIF})  private  protected    { IInterface }  {$IFDEF FPC}    function QueryInterface(constref IID: TGUID; out Obj): HResult; virtual; {$IFDEF WINDOWS}stdcall {$ELSE}CDECL{$ENDIF};  {$ELSE}    function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; {$ENDIF}    function _AddRef: Integer;  {$IFDEF WINDOWS}stdcall {$ELSE}CDECL{$ENDIF};    function _Release: Integer;  {$IFDEF WINDOWS}stdcall {$ELSE}CDECL{$ENDIF};  end;  implementation {$IFDEF FPC}function TEditButtonEh.QueryInterface(constref IID: TGUID; out Obj): HResult; {$IFDEF WINDOWS}stdcall {$ELSE}CDECL{$ENDIF};{$ELSE}function TEditButtonEh.QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;{$ENDIF}begin  if GetInterface(IID, Obj)    then Result := 0  else Result := E_NOINTERFACE;end; function TEditButtonEh._AddRef: Integer; {$IFDEF WINDOWS}stdcall {$ELSE}CDECL{$ENDIF};begin  Result := -1;end; function TEditButtonEh._Release: Integer; {$IFDEF WINDOWS}stdcall {$ELSE}CDECL{$ENDIF};begin  Result := -1;end; end. ---------------------------------------------------------------------- dmitryb · 2018-09-05 17:52 Yes. Thank you.