如何在Linux中从动态库(libsample.so)生成导入库(libsample.a) [英] How to generate import libray (libsample.a) from dynamic library (libsample.so) in Linux

查看:191
本文介绍了如何在Linux中从动态库(libsample.so)生成导入库(libsample.a)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux上创建动态库后,但我想从动态库.so生成符号链接导入库(.a)。我做了什么步骤?

解决方案

实际上,linux中的动态库不需要'import library'。 'import library'是Windows中的想法:当你构建一个dll,vs也会给你一个lib文件作为'导入库',或者你必须通过一些'ref'文件构建自己的'导入库' / p>

*。a在Linux中是归档文件,我们说,我们说,压缩目标文件并将其作为一个对象,不完全,但在某种意义上可以这样理解它。获得* .a并调用它很容易。



*。a:



{compiler,gcc is一个简单的例子} -g -c * .c



ar - {一些标志,取决于你的编译器,-c是一个简单的例子} liba.a * / p>

{linker,gcc是一个简单的例子} -g -oa -la -L。


After create dynamic library on Linux but I want to generate symbol link import library (.a) from dynamic library .so. What steps I do?

解决方案

actually, the dynamic library in linux did not need 'import library'. 'import library' is the idea in windows: when you build a dll, vs will also give you a lib file as the 'import library', or you have to build your own 'import library' through some 'ref' files.

*.a in linux is archive file, which is just, we say, zip the object file and make it as one object, not exactly, but, in some meaning you can understand it in that way. get a *.a and invoke it is easy.

*.a:

{compiler, gcc is a simple example} -g -c *.c

ar -{some flags, depends your compiler, -c is a simple example} liba.a *.o

{linker, gcc is a simple example} -g -o a -la -L.

这篇关于如何在Linux中从动态库(libsample.so)生成导入库(libsample.a)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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