我根本没有使用 Delphi 的经验,我有一个非常古老的项目,可以在 Delphi 的 2nd、3rd 版本中编译,但不能在 Delphi 4 中工作。问题在于在新版本中工作方式不同的指针。
这些代码段导致错误“需要变量”:
pEnabled := @pClrWire_s^.enabled;
pEnabled := @Enabled;
pNEnabled := @pName_s^.Enabled;
其中 pEnabled 是:
const
pEnabled : ^boolean = nil;
pClrWire_s 和 pName_s 也是指针:
pClrWire_s : TpImage; {pointer to an image of colored wire}
pName_s : TpNamed; {pointer to the identifier}
TpImage 和 TpNamed 的描述可以在项目的其他文件中找到:
type
TpImage = ^TImage;
TpNamed = ^TNamed;
TNamed = class(TLabel)
这个问题能在不认真重写整个代码的情况下解决吗?是什么导致Delphi 4出现这样的问题?