How to update shared library file

891 views Asked by At

I'm trying to add a .lo object file compiled through libtool with clang into a shared library file.

$ libtool --tag=CC --mode=compile clang -c newobject.c -shared

Is there an equivalent command to

$ ar r libmylib.a newobject.o

for shared libraries?

Alternatively, is there a way to dump all the .lo files that are already contained in a .so file so I can re-create tne shared library, say, using this command?

$ libtool --mode=link ld -soname libmylib.so -o libmylib.so.1 libmylib.so.0 newobject.o
1

There are 1 answers

0
Jonathan Leffler On

There is no way to incrementally alter a shared library. You need all the component object files and rebuild the shared library from those each time.

I don't know of a way to extract object files from a shared library.