[Lazarus-es] Error al compilar Zeos Component

José Mejuto joshyfun en gmail.com
Sab Nov 20 02:11:48 CET 2010


Hello José,

Saturday, November 20, 2010, 1:32:34 AM, you wrote:

JAC> Hola, he probado lo que me indicabas pero sigue dando el mismo error. Te
JAC> pongo toda la lista de errores por si te puede dar alguna pista.
JAC> Muchas gracias por tu sugerencia.
JAC> Un saludo.

JAC> zeoslib/src/core/ZClasses.pas(84,22) Error: No matching implementation
JAC> for interface method "IUnknown.QueryInterface(constref TGuid,out <Formal
type>>):LongInt; CDecl;" found
JAC> zeoslib/src/core/ZClasses.pas(84,22) Error: No matching implementation
JAC> for interface method "IUnknown._AddRef:LongInt; CDecl;" found
JAC> zeoslib/src/core/ZClasses.pas(84,22) Error: No matching implementation
JAC> for interface method "IUnknown._Release:LongInt; CDecl;" found
JAC> zeoslib/src/core/ZClasses.pas(183,14) Warning: An inherited method is
JAC> hidden by "TZAbstractObject.Equals(const IUnknown):Boolean;"
JAC> zeoslib/src/core/ZClasses.pas(186,14) Warning: An inherited method is
JAC> hidden by "TZAbstractObject.ToString:AnsiString;"
JAC> zeoslib/src/core/ZClasses.pas(190,1) Fatal: There were 3 errors
JAC> compiling module, stopping

Veo que lo estás compilando en Linux, así que has de cambiar también
los stdcall del IUnknown a CDecl ya que ahora en Linux no usan stdcall
(de hecho tampoco lo usaba antes, simplemente "pasaba por encima").

Vamos que debería quedarte algo así:

{$IFDEF FPC}
PDateTime = ^TDateTime;

TAggregatedObject = class(TObject)
private
  FController: Pointer;
  function GetController: IInterface;
protected
  function QueryInterface(constref IID: TGUID; out Obj): HResult; cdecl;
  function _AddRef: Integer; cdecl;
  function _Release: Integer; cdecl;
public
  constructor Create(const Controller: IInterface);
  property Controller: IInterface read GetController;
end;

TContainedObject = class(TAggregatedObject, IInterface)
protected
  function QueryInterface(constref IID: TGUID; out Obj): HResult; virtual; cdecl;
end;
{$ENDIF}

O puedes recrear los ifdefs de freepascal para que se auto-adapte a la
plataforma:

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;

A este define {$IFDEF FPC_HAS_CONSTREF} no se si tendrás acceso en tu
unit (la de zeos vamos) :-?

-- 
Best regards,
 José





More information about the Lazarus-es mailing list