Delphi Compiler Error
E2270 Published property getters and setters must have %s calling convention
Reason for the Error & Solution
A property appearing in a published section has a getter or setter procedure that does not have the correct calling convention.
unit Produce; interface type Base = class public function getter : Integer; cdecl; published property Value : Integer read getter; end; implementation function Base.getter : Integer; begin getter := 0; end; end.
This example declares the getter function getter for the published property Value to be of cdecl calling convention, which produces the error.
unit Solve; interface type Base = class public function getter : Integer; published property Value : Integer read getter; end; implementation function Base.getter : Integer; begin getter := 0; end; end.
The only solution to this problem is to declare the getter function to match the correct calling convention, which is the default. As can be seen in this example, no calling convention is specified.