如何创建静态库的共享对象文件 [英] How to create a shared object file from static library
本文介绍了如何创建静态库的共享对象文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建一个静态库的共享对象文件吗?我使用Cygwin的。
是下面的语法是否正确?
的gcc -o -shared libexample.so libexample.a
解决方案
的gcc -o -shared -Wl libexample.so, - 整个归档libexample.a
注重,往往你会希望结合在你的。所以对象被编译成PIC,你不经常想要一个静态库。东西
How to create a shared object file from a static library? I am using Cygwin.
Is the following syntax correct?
gcc -shared -o libexample.so libexample.a
解决方案
gcc -shared -o libexample.so -Wl,--whole-archive libexample.a
Pay attention that often you'll want the objects combined in your .so to be compiled as PIC, something you don't often want for a static library.
这篇关于如何创建静态库的共享对象文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文