首页 > 解决方案 > Indy 10 编译失败并启用 FASTMM 编译器指令

问题描述

我正在使用 Delphi 7。我昨天从 Fulgan 的页面下载了最新版本的 Indy (10.5462)。

有一个批处理文件 (Full_d7.bat) 通常可以成功编译 Indy。

现在,如果我在 Core、Protocols 和 System 目录中的 IdCompilerDefines.inc 中定义 USE_FASTMM4,编译时会返回以下错误:

IdGlobal.pas(2229) Error: Declaration of 'GetBytes' differs from declaration in
interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetCharCount' differs from declaration
 in interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetChars' differs from declaration in
interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetChars' differs from declaration in
interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetChars' differs from declaration in
interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetString' differs from declaration in
 interface 'IIdTextEncoding'
IdGlobal.pas(3500) Error: Incompatible types: 'Char' and 'Integer'
IdGlobal.pas(3502) Error: Incompatible types: 'Char' and 'Integer'
IdGlobal.pas(3527) Error: Incompatible types: 'Byte' and 'Char'
IdGlobal.pas(3592) Error: Incompatible types: 'Char' and 'Byte'
IdGlobal.pas(3594) Error: Incompatible types: 'Char' and 'Byte'
IdGlobal.pas(3617) Error: Incompatible types
IdGlobal.pas(3620) Error: Incompatible types: 'Word' and 'Char'
IdGlobal.pas(3663) Error: Incompatible types: 'Char' and 'Byte'
IdGlobal.pas(3665) Error: Incompatible types: 'Char' and 'Byte'
IdGlobal.pas(3687) Error: Incompatible types: 'Word' and 'Char'

这是 D7 版本中的错误还是我遗漏了什么?使用 FastMM 时,是否还需要在配置文件中定义一些内容?

标签: delphicompiler-errorsdelphi-7indyindy10

解决方案


当支持没有这些类型可用的旧编译器时,FastMM 声明了它自己的几个 Delphi 本机数据类型(Native(U)Int、、等)的版本。(U)IntPtr

但是,它也在D2009PByte之前的所有 Delphi 版本中声明,它不应该这样做(因为PByte在 RTL 的System单元中可用,至少可以追溯到 Delphi 5)。重新声明 ofPByte干扰了 IndyPByteIdGlobal单元中的使用 - 但仅在 D2006 之前的 Delphi 版本中(因为 Indy 在以后的 Delphi 版本中不直接使用 FastMM)。

我已经为 Indy 签入了一个补丁来解决这个问题(SVN rev 5463),并向FastMM提交了一个错误报告


推荐阅读