我可以使用gcc 3.4.2和gcc 4.2.2编译的静态库吗? [英] Can I use a static library compiled with gcc 3.4.2 with gcc 4.2.2

查看:114
本文介绍了我可以使用gcc 3.4.2和gcc 4.2.2编译的静态库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用gcc 3.4.2编译的静态库。我正在建立一个依赖于这个静态库的共享库。我将用gcc 4.2.2构建这个共享库(.so)。我想知道在gcc 4.2.2共享库中使用3.4.2静态库会有什么隐患?

如果你的静态库是基于c ++的,那么我认为由于ABI的改变,它可能不兼容,但根据这个其他的stackoverflow问题,gcc是以gcc 3.4.0开始的向前兼容的。所以你可以没事。我不得不重建所有从gcc 3.0 / 3.2到gcc 3.4.6的库,但我还没有完成转换到4.0以后的版本。



GCC ABI兼容性


I have a static library that is compiled with gcc 3.4.2. I am building a shared library that relies on this static lib. I will be building this shared library (.so) with gcc 4.2.2. I was wondering what are the potential pitfalls of using the 3.4.2 static library in a gcc 4.2.2 shared library?

解决方案

If your static library is c++ based then I thought due to ABI changes it probably would not be compatible but according to this other stackoverflow question, gcc is forward compatible starting with gcc 3.4.0. So you could be ok. I had to rebuild all of my libraries going from gcc 3.0/3.2 to gcc 3.4.6 but I have not done the conversion to post-4.0 yet.

GCC ABI Compatibility

这篇关于我可以使用gcc 3.4.2和gcc 4.2.2编译的静态库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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