在FPC下的自动化对象中使用标识符或保留字 [英] Using a indentifier or reserved word in a automation object under FPC
问题描述
实际上,我在Free Pascal下使用OLE自动化,但是某些对象具有使用保留字作为名称的属性,因此我无法编译代码.
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.
检查此示例
MyObj : OleVariant;
begin
MyObj := CrealeOleObject('AObject');
MyObj.Descriptor := Param1;
MyObj.Type := Param2; //this line generates a error
这是错误
StdOleAux.pas(783,15)致命:语法 错误,预期为标识符",但 找到"TYPE"
StdOleAux.pas(783,15) Fatal: Syntax error, "identifier" expected but "TYPE" found
所以问题是,当它们具有保留字的名称时,如何在FPC中访问此属性?
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
FPC 2.2.4
拉撒路0.9.28.2
Lazarus 0.9.28.2
使用{$MODE DELPHI}
推荐答案
您需要FPC版本"2.5.1",请参见报告,该问题已在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.
这篇关于在FPC下的自动化对象中使用标识符或保留字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!