E2262 Implements getter must be %s calling convention (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

The compiler has encountered a getter or setter which does not have the correct calling convention.


program Produce;
type
  I0 = interface
  end;

  T0 = class(TInterfacedObject, I0)
    function getter : I0; cdecl;
    property p0 : I0 read getter implements I0;
  end;

function T0.getter : I0;
begin
end;
end.


As you can see in this example, the cdecl on the function getter causes this error to be produced.


program Solve;
type
  I0 = interface
  end;

  T0 = class(TInterfacedObject, I0)
    function getter : I0;
    property p0 : I0 read getter implements I0;
  end;

function T0.getter : I0;
begin
end;
end.


The only solution to this problem is to remove the offending calling convention from the property getter declaration.