I have some static library(libxxx.a libyyy.a).
And I want to generate my library(libzzz.a), libzzz.a will use libxxx.a and libyyy.a
I wan't my application only use libzzz.a, (means libzzz.a had include libxxx.a, libyyy.a), how can I do that? Thank you.
example:
I have zzz.c.
I do
gcc -c zzz.c -o zzz.o
ar cr libzzz.a libxxx.a libyyy.a zzz.o
But It can't work.
hergp
2
First you have to extract all object files from libxxx.a and libyyy.a in an empty directory
mkdir somedir
cd somedir
ar xv /path/to/libxxx.a
ar xv /path/to/libyyy.a
Then copy all your own object files to this directory
cp /path/to/zzz.o .
Now you can create your own library
ar cv libzzz.a *.o
Thank you.
I will test.
---------- Post updated at 02:38 AM ---------- Previous update was at 01:51 AM ----------
The libxxx.a and libyyy.a have the .oject file with same name.
What should I do?
hergp
4
If you need them both, just rename one of them to another name. The filename of the object is not relevant for linking.
If both object files export symbols with the same name, you have to decide, which one to keep.