2
votes

I got errors while compiling OmniThreadLibrary-3.03b in Delphi 2009 ...

Errors are:

[DCC Error] GpStuff.pas(332): E2003 Undeclared identifier: 'GetAsAnsiString'

[DCC Error] GpStuff.pas(332): E2003 Undeclared identifier: 'GetSize'

[DCC Error] GpStuff.pas(332): E2003 Undeclared identifier: 'SetAsAnsiString'

[DCC Error] GpStuff.pas(332): E2003 Undeclared identifier: 'GetValue'

[DCC Fatal Error] OmniThreadLibraryRuntime2009.dpk(54): F2063 Could not compile used unit '..\src\GpStuff.pas'

Anyone know why its prompting all above errors in Delphi 2009???

1
Fixed GpStuff was added to the OmniThreadLibrary repo. - gabr

1 Answers

1
votes

It looks to me like a compiler bug in Delphi 2009. The undeclared identifiers in TGpBuffer that trigger the compiler warnings have strict protected visibility. The code looks like this:

type
  TGpBuffer = class(TInterfacedObject, IGpBuffer)
  strict private
    FData: TMemoryStream;
  strict protected
    function  GetAsAnsiString: AnsiString; inline;
    function  GetSize: integer; inline;
    function  GetValue: pointer; inline;
    procedure SetAsAnsiString(const value: AnsiString);
  public
    constructor Create; overload;
    constructor Create(data: pointer; size: integer); overload;
    destructor  Destroy; override;
    procedure Add(b: byte); overload; inline;
    procedure Add(ch: AnsiChar); overload; inline;
    procedure Allocate(size: integer); inline;
    procedure Assign(data: pointer; size: integer); inline;
    procedure Clear; inline;
    function  IsEmpty: boolean; inline;
    property AsAnsiString: AnsiString read GetAsAnsiString write SetAsAnsiString;
    property Size: integer read GetSize;
    property Value: pointer read GetValue;
  end; { TGpBuffer }

The errors occur on the property declarations, which all refer to strict protected getters and setters. This must be a compiler error. How can a class declare an identifier and not be able to see it? The code compiles in Delphi 2010 so I can only believe that this is a compiler bug in Delphi 2009, and possibly earlier (strict private and strict protected were added in Delphi 2005).

I suggest that you change strict protected to protected and see if the code compiles. You'll have the same problem with the GpLists unit. If that is indeed the problem then please do submit a bug report at the OTL Google Code site.

Finally, I recommend that you take the latest version from revision control rather than a canned ZIP file download.

Update: Primož has committed a change to the repo that works around the bug.