No actually I using AIX. We don't have ldconfig on AIX.
Main Topics
Browse All TopicsHello experts,
How can I link my library to standard libc.a.
I have a library which has the definition of some of the standard input/output functions. I would like to link this library to libc.a such that when ever an application make a call to any of this rountines, it should be statisfied from my library.That is my routines should over ride the standard library functions. The standard functions are defined in shr.o in libc.a.
Please someoone help be in this. This is quite urgent.
Thanks
Shajith Chandran
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I think you will need to replace your libc.a with a modified version containing your replacement routines. This is kind of a brute force way to do it, but it ought to work pretty well.
1. Make a backup copy of libc.a in case you mess things up.
2. Use nm on libc.a to find out which .o files contain the functions you would like to replace.
3. Compile your replacement functions into some .o files.
4. Use ar to remove the old .o files from libc.a.
5. Use ar to add your new .o files into libc.a
It would be better if you could take your .o files, put them into your own library, then reconfigure your compiler to go for your library before going for the system libc.a. I don't know if this is possible for your AIX compiler.
easiest is to include these functions in different library under different names, since altering libc may carry unwanted consequences.
to relink libc you have to use ar to repackage .a file
then use ld or cc to link libc.so back
best if target files are not in /usr/lib, but in some other place, which can be added to your application using LIBPATH variable.
such relinking has to be done after applying any patch to system
Business Accounts
Answer for Membership
by: sunnycoderPosted on 2005-04-27 at 07:15:26ID: 13876319
Hi shaj,
I am assuming that you are on a Linux box. look into man pages of ldconfig ... You need to edit the /etc/ld.so.conf file to add your path as first component and then run ldconfig.
Cheers!
sunnycoder