g ++版本兼容性 [英] g++ version compatibility

查看:217
本文介绍了g ++版本兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个特定的gcc相关问题。我有一个库编译g ++ 4.1.2,我想给用户。用户可以在他们的代码中使用我们的API,并链接我们的库来创建最终的可执行文件。

This is a specific gcc related question. I have a library compiled with g++ 4.1.2 that I want to give the user. The user can use our API in their code and link our library to create the final executable.

我有的问题与g ++版本兼容性有关。我们的一些用户使用g ++ 4.4.3,其他4.3.3,还有其他4.2.1。是库编译与4.1.2兼容所有这些g ++版本?我的猜测是他们应该是因为他们是ABI兼容。但是我们的一些客户不同意。我真的不想运送同一个库的四个不同版本。如果它们不兼容是有具体的原因,还是有办法避免不兼容?

The question I have is related to g++ version compatibility. Some of our users are using g++ 4.4.3, others 4.3.3, and still others 4.2.1. Is the library compiled with 4.1.2 compatible with all these g++ versions? My guess is they should be because they are ABI compatible. But some of our customers don't agree. I really don't want to ship four different versions of the same library. If they are incompatible is there a concrete reason or is there a way to avoid the incompatibility?

推荐答案

其他只要它们使用相同的ABI(应用程序二进制接口)。最后一次GCC正式改变了ABI,据我所知,是与v3.3或v3.4。

Two libraries are compatible with each other as long as they use the same ABI (Application Binary Interface). The last time GCC officially changed the ABI, as far as I recall, was with v3.3 or v3.4.

但是,这只是真的符合代码。任何依赖于未记录或未指定行为的源都可能会中断而无需另行通知。

However, this is only true for compliant code. Any source that relies on undocumented or unspecified behaviour might break without further notice.

因此答案是:你的编译器版本都是兼容的;问题是源代码是否是。

So the answer is: Your compiler versions are all compatible; the question is whether the source code is.

这篇关于g ++版本兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆