C++库兼容性
我目前正在编写一个库,并正在考虑从 GCC 4.1.2 迁移到 GCC 4.5.2(最新版本)。如果我将代码编译到静态库中,我是否可以假设编译器兼容性(显然在同一操作系统上)对于客户端来说应该不是问题?
编辑 进一步澄清:如果我向客户端提供一个用 gcc 4.5.2 编译的静态链接库,那么在必须使用的编译器和版本方面,这对该库的用户有何限制?
I am currently writing a library and am considering moving from GCC 4.1.2 to 4.5.2 (latest release) of GCC. If I compile my code into a static library can I assume compiler compatibility (on the same OS obviously) should be a non-issue for clients?
EDIT
To further clarify: if I provide a client a statically linked library compiled with gcc 4.5.2, what restrictions does this place on users of this library in terms of the compiler and version they must use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
刚刚遇到这个,我相信它回答了我的问题 http://gcc.gnu.org/bugs/#非错误:
据我了解,我需要确保客户将我的库与 gcc 的主要版本兼容版本链接起来。
Just came across this which I believe answers my question from http://gcc.gnu.org/bugs/#nonbugs:
From this as I understand it I'll need to ensure clients are linking my library in with a major-release compatable version of gcc.
如果您提供静态库或动态库,这并不重要,用户仍然需要使用兼容的编译器/链接器来链接它。通常,当 GCC 进行 ABI 更改时,他们会提供一个可以设置为使用旧 ABI 的开关。我知道他们从 3.x 升级到 4.x 甚至 4.x 系列中的几个版本时都这样做了。
It doesn't really matter if you are providing a static library or dynamic library, the users will still need to use a compatable compiler/linker to link against it. Usually when GCC does a ABI change they offer a switch that can be set to use the old ABI. I know that they did that when they went from 3.x to 4.x and even a couple of the releases within the 4.x series.