2
votes

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 do 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 .

1
The flags of your post need to be more specific (library...) - Phong
You need to show us how you are performing the link. - anon
Is there even a way to link without possibly not including static library? - Murali
i am working on AIX machine and i am using -Ldir -llibname option for linking. No i cannot skip this library only other way is to convert it to shared lib but it's a 3rd party lib so i do not have access to source code . - user258367
@wizard: yes, you just need to create one more dll library which will contain the dependent static library. - Phong

1 Answers

0
votes

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