LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-07-2021, 10:52 PM   #1
centguy
Member
 
Registered: Feb 2008
Posts: 627
Blog Entries: 1

Rep: Reputation: 48
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 ?
 
Old 04-07-2021, 11:03 PM   #2
centguy
Member
 
Registered: Feb 2008
Posts: 627

Original Poster
Blog Entries: 1

Rep: Reputation: 48
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.

Last edited by centguy; 04-07-2021 at 11:21 PM.
 
Old 04-11-2021, 09:28 AM   #3
centguy
Member
 
Registered: Feb 2008
Posts: 627

Original Poster
Blog Entries: 1

Rep: Reputation: 48
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error with GCC: while loading shared libraries: libisl.so.22: cannot open shared object file: No such file or directory juju Slackware 18 04-30-2021 05:25 PM
Rosewill RSV-S8 external enclosure. Any experience? Nutria Linux - Hardware 10 06-06-2013 05:43 PM
[SOLVED] SEGMENTATION FAULT using gcc 4.4.4 -O2 , works with gcc 4.1.0 -O2 or gcc 4.4.4 -O1 amir1981 Programming 36 07-26-2010 06:07 PM
gcc link shared library against another shared library qcp Linux - Newbie 1 07-25-2008 11:15 AM
equivalent of conio.h in gcc? (and some more gcc-newbie questions) Valkyrie_of_valhalla Programming 3 09-22-2007 03:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration