Delphi Error – E2262 Implements getter must be %s calling convention

Delphi Compiler Error

E2262 Implements getter must be %s calling convention

Reason for the Error & Solution

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.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...