RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2270: Published property getters and setters must have %s calling convention (Delphi)

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.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!