转换静态库到共享库? [英] Convert a Static Library to a Shared Library?

查看:162
本文介绍了转换静态库到共享库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个第三方库,它主要由大量静态的( .A )的库文件。我可以编译成这样一个 .A 库文件,但我真的需要它是一个的.so 共享库文件。

I have a third-party library which consists mainly of a large number of static (.a) library files. I can compile this into a single .a library file, but I really need it to be a single .so shared library file.

有没有什么办法来转换一个静态 .A 文件到一个共享的的.so 文件?或者更一般有静态的数量庞大的几个的.o 对象相结合 .A 文件的好方法文件合并为一个的.so 文件?

Is there any way to convert a static .a file into a shared .so file? Or more generally is there a good way to combine a huge number of static .a files with a few .o object files into a single .so file?

推荐答案

这是否(当然,适当的-L的)

Does this (with appropriate -L's of course)

gcc -shared -o megalib.so foo.o bar.o -la_static_lib -lb_static_lib

不去做呢?

这篇关于转换静态库到共享库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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