ar -rsv some.a new.o works, what is the equivalent for gcc -shared some.so new.o
ar -rsv some.a new.o
adds new.o into the existing some.a However gcc -shared some.so new.o seems to "add" the new.o into the shared object some.so while removing the old stuff. Is something like gcc -shared -add_to_existing some.so new.o ? |
https://www.cprogramming.com/tutoria...linux-gcc.html
tells how to generate a new shared object based on one NEW src file. But if we have multiple src files then this method won't work. i wish to keep adding new entries in .so just like using ar. |
I have two solutions:
1. convert a.o to liba.so every time we create a.o via gcc -shared -o liba.so a.o to link use gcc -shared -L/pathto.so/ -la -lb etc main.c 2. generate a full liball.so from all .o gcc -shared -o /pathto.so/liball.so /pathto.so/*.o Then use gcc main.c -L/pathto.so/ -lall Not sure this is the standard way but it works. |
All times are GMT -5. The time now is 01:39 AM. |