开发者

How to generate import library (libsample.a) from dynamic library (libsample.so) in Linux

开发者 https://www.devze.com 2023-01-10 13:41 出处:网络
After creating a dynamic library o开发者_开发百科n Linux I want to generate an import library (.a) from the dynamic library (.so). How can I do it?actually, the dynamic library in linux did not need \

After creating a dynamic library o开发者_开发百科n Linux I want to generate an import library (.a) from the dynamic library (.so). How can I do it?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消