为什么还有人在dll函数声明头中使用export指示字?---说export的用法
来源:互联网 发布:融资融券数据 编辑:程序博客网 时间:2024/04/29 07:40
这里摘抄Delphi7帮助文档中的一段:
Calling conventions
When you declare a procedure or function, you can specify a calling convention using one of the directives register, pascal, cdecl, stdcall, and safecall. For example,
function MyFunction(X, Y: Real): Real; cdecl;
...
Calling conventions determine the order in which parameters are passed to the routine. They also affect the removal of parameters from the stack, the use of registers for passing parameters, and error and exception handling. The default calling convention is register.
The register and pascal conventions pass parameters from left to right; that is, the left most parameter is evaluated and passed first and the rightmost parameter is evaluated and passed last. The cdecl, stdcall, and safecall conventions pass parameters from right to left.
For all conventions except cdecl, the procedure or function removes parameters from the stack upon returning. With the cdecl convention, the caller removes parameters from the stack when the call returns.
The register convention uses up to three CPU registers to pass parameters, while the other conventions pass all parameters on the stack.
The safecall convention implements exception "firewalls." On Windows, this implements interprocess COM error notification.
The table below summarizes calling conventions.
Calling conventions
Directive Parameter order Clean-up Passes parameters in registers?
register Left-to-right Routine Yes
pascal Left-to-right Routine No
cdecl Right-to-left Caller No
stdcall Right-to-left Routine No
safecall Right-to-left Routine No
The default register convention is the most efficient, since it usually avoids creation of a stack frame. (Access methods for published properties must use register.) The cdecl convention is useful when you call functions from shared libraries written in C or C++, while stdcall and safecall are recommended, in general, for calls to external code. On Windows, the operating system APIs are stdcall and safecall. Other operating systems generally use cdecl. (Note that stdcall is more efficient than cdecl.)
The safecall convention must be used for declaring dual-interface methods. The pascal convention is maintained for backward compatibility. For more information on calling conventions, see Program control.
The directives near, far, and export refer to calling conventions in 16-bit Windows programming. They have no effect in 32-bit applications and are maintained for backward compatibility only.
注意上面粗体字。
我为什么写这篇blog:http://community.csdn.net/Expert/TopicView1.asp?id=4915803
(其中的问题与export无关)
- 为什么还有人在dll函数声明头中使用export指示字?---说export的用法
- shell中export的用法
- MakeFile中export的使用
- linux中export用法
- linux中export用法
- linux中export用法
- linux中export用法
- linux中export用法
- linux中export用法
- linux中export用法
- linux中export用法
- linux中export用法
- linux中export用法
- linux中export用法
- shell export的变量在python中使用
- export、export default、import的用法
- export关键字的用法
- export的用法记录
- Tags or Semantic Web
- 在DataGridView中显示行号(C#)
- 微软移动与嵌入式产品部2006财年总结
- 父母必看(现代教育与私塾教育的面面观)
- 在桌面上自动创建快捷方式
- 为什么还有人在dll函数声明头中使用export指示字?---说export的用法
- 听遍邓丽君的歌曲,那么就下载她的全部! 我给出的方法
- shtml 与 html区别!!!!!!!!!!!!!!
- 试图运行项目时出错: 无法在 Web 服务器上启动调试。您没有调试该服务器的权限。
- 团队开发框架(Developement Structure for Team),内容列表及整理计划
- J2SE 5.0中的泛型
- Win2003中apache2分别整合tomcat5和iis6的终极教程
- 用SVG写的数独小游戏
- 心有多大,宇宙就有多大