加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

德尔福的“本地”指令

发布时间:2020-12-15 10:17:46 所属栏目:大数据 来源:网络整理
导读:我正在坐在调试一些代码,我在SysUtils.pas中偶然发现了这一行: procedure ConvertError(ResString: PResStringRec); local; 本地关键字是做什么的?似乎ConvertError函数没有在文件的接口部分中声明,这仅仅是说明函数确实是本地的,还是使用这个指令以外
我正在坐在调试一些代码,我在SysUtils.pas中偶然发现了这一行:
procedure ConvertError(ResString: PResStringRec); local;

本地关键字是做什么的?似乎ConvertError函数没有在文件的接口部分中声明,这仅仅是说明函数确实是本地的,还是使用这个指令以外的实际的好处?

解决方法

它可追溯到Linux编译器Kylix。以下是我在Delphi 6语言指南中可以看到的第9-4页:

The directive local,which marks routines as unavailable for export,is platform-specific and has no effect in Windows programming.

On Linux,the local directive provides a slight performance optimization for routines that are compiled into a library,but are not exported. The directive can be specified for standalone procedures and functions,but not for methods. A routine declared with local—for example.

06000

—does not refresh the EBX register and hence

  • cannot be exported from a library.
  • cannot be declared in the interface section of a unit.
  • cannot have its address take or be assigned to a procedural-type variable.
  • if it is a pure assembler routine,cannot be called from a another unit unless the caller sets up EBX.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读