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

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 X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...