开发者

Can i create a shared lib which has both shared and static library

I am tryng to create a shared library which internally is linking to many shared lib and a static lib . In my case my shared lib is not including static lib . I want to know what i am trying whether it is correct or i need to convert static lib to shared lib and then d开发者_StackOverflow社区o the linking .

I need to know that is there any makefile flag which allow me to add static library along with shared lib .

Please suggest .


You can create a library which is dependent of other library (static and dynamic). But you need to integrate the static library part inside your (because this one can not be load dynamically)

dependence of your source code:
your_library -> static_library.lib
your_library -> dynamic_library.dll

how you implement can it (to be used by an executable):

your_library.dll (which contain your_library and static_library source code)
dynamic_library.dll (to distribute with your_library.dll)

or

your_library.dll
static_library.dll (to be created from the static_library.lib)
dynamic_library.dll (to distribute with your_library.dll)

edit: here may what you are looking for convert static library to shared library (it is for linux, but you will have the same for os):

.a files are just archives of .o object files, so all you need to do is unpack the archive and repackage them as a shared object (.so)
ar -x mylib.a
gcc -shared *.o -o mylib.so
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜