view contents of shared library

Hi ,

i have two doubts in Hp-Ux

1) How to View objects or contents in a shared library in HP-Ux
2) Can i added a c object file to the existing shared file from a different directory .
for example :

I have two directories X and Y

I have a.o b.o c.o object files in X directory

I create a shared library
ld -b -o libx.sl a.o b.o c.o

I Have d.o in Y directory now i want to add d.o to shared libx.sl created in X directory .

ld -b -o libxl.o ../d.o ( will t

Many thanks
Narendra

  1. use nm <sharedlibrary> | more
  2. Assuming I understand what you're saying - You need to compile your module then relink the whole shared library. Which means you need all of the source or objects used to make that library to start with. You cannot just add an object.

Hi Jim ,

Thanks for your updates Jim 1st one worked fine .

I got some info reg the 2nd one .
to be more clear
My question was whether i need to have all the source files in one place ( in same directory) and compile in same directory also having all the object files in the same directory and make a shared lib in the same directory .

in simple statement do i need to have all the c source files ,object files e and create a shared lib from object files in the same directory .

Does that mean i cannot have c source file and its object file in another directory to be added to the exiting shared library present in other directory

or It is must that i have to take the c source file and compile it in the directory where the shared librray is created with the rest of files

Ofcourse i will once again add all the .o files into shared lib when it is newly created or when a new object is created

Soory for the lengthy explanation

if anything else let me know

Many Thanks
naren

You can keep all the *.o in one directory & create the shared library.
No need to keep the source in that dir.

In fact, if you want to keep things neat, you can use ar to create a single file with most (or All) of your object files. ar will let you update existing objects, or add new ones.

try man ar