在 FPC 下的自动化对象中使用标识符或保留字

发布于 2024-10-08 19:14:05 字数 506 浏览 0 评论 0原文

实际上我在 Free Pascal 下使用 OLE 自动化,但某些对象具有使用保留字作为名称的属性,因此我无法编译代码。

检查此示例,

  MyObj : OleVariant;
begin
  MyObj := CrealeOleObject('AObject');
  MyObj.Descriptor   := Param1;
  MyObj.Type            := Param2;  //this line  generates a error

这是错误

StdOleAux.pas(783,15) 致命:语法 错误,需要“标识符”,但是 找到“类型”

所以问题是当 FPC 中的这些属性的名称是保留字时,我如何访问这些属性?

FPC 2.2.4

Lazarus 0.9.28.2

使用 {$MODE DELPHI}

Actually i am using OLE automation under Free Pascal , but some objects have properties which uses reserverd words as names, so i cannot compile the code.

check this sample

  MyObj : OleVariant;
begin
  MyObj := CrealeOleObject('AObject');
  MyObj.Descriptor   := Param1;
  MyObj.Type            := Param2;  //this line  generates a error

this is the error

StdOleAux.pas(783,15) Fatal: Syntax
error, "identifier" expected but
"TYPE" found

so the question is how i can access this properties in FPC when they have a name which is a reserved word?

FPC 2.2.4

Lazarus 0.9.28.2

using {$MODE DELPHI}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流心雨 2024-10-15 19:14:05

您需要 FPC 版本“2.5.1”,请参阅报告 “在 Delphi 模式下允许扩展标识符” 已于 2010-03-22 解决。

You need version '2.5.1' of FPC, see the report "Allow Extended Identifiers in the Delphi mode" which has been resolved as fixed at 2010-03-22.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文