admin 管理员组文章数量: 1087678
C++动态链接库的兼容性
一.动态链接库的ABI
动态链接库的兼容性是由于库的ABI(Application binary interface)引起,ABI与API类似,但是主要包括一些诸如函数调用的堆栈结构、符号命名、参数规则、数据结构的内存分布等方面的规定。二.引起动态链接库不兼容的行为
- 删除一个导出类;
- 改变导出类的继承层次
- 改变模板的模板参数
- 删除一个导出函数
- 改变函数的inline属性
- 改变函数的签名
- 在一个非虚基类或者没有含有虚函数的类中添加一个虚函数
- 改变虚函数的声明次序
- ......
三.一般不会引起动态链接库不兼容的行为
- 增加一个非虚函数
- 删除没有被inline函数调用的非虚函数
- 改变一个函数的默认参数
- 增加新的static数据成员
- 导出一个新的参数
- 增加或者删除一个友元声明
- ......
四.详细的内容(英文)
详细的内容可以参考:++Note about ABI
This text applies to most C++ ABIs used by compilers which KDE can be built with. It is mostly based on the Itanium C++ ABI Draft, which is used by the GCC C++ compiler since version 3.4 in all platforms it supports. Information about Microsoft Visual C++ mangling scheme mostly comes from this article on calling conventions (it's the most complete information found so far on MSVC ABI and name mangling).
Some of the constraints specified here may not apply to a given compiler. The goal here is to list the most restrictive set of conditions when writing cross-platform C++ code, meant to be compiled with several different compilers.
This page is updated when new binary incompatibility issues are found.
本文标签: C动态链接库的兼容性
版权声明:本文标题:C++动态链接库的兼容性 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1700372414a418416.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论