Making shared libraries
Andrew J. Schorr
schorr at ead.dsa.com
Fri Oct 12 06:00:27 AEST 1990
My question is simple: how do you make shared libraries?
As I understand it, the process is as follows:
1. compile the source into .o files as you would normally;
are there any special compiler flags required here?
I don't seem to see anything analogous to -pic on a Sun.
2. create an export list for the library;
I'm using nm to make it automatically as follows:
nm -g {object files} | \
awk '$(NF-1) == "D" {print $NF}' > export.list
3. link the .o files into a shared object as follows:
ld -r -o shared_object.o {object files} -bE:export.list \
-bM:SRE -T512 -H512
4. insert the resulting shared_object.o into an archive (if so desired)
Everything seems to work, but when I run a program linked against
the library, I get the following messages:
Could not load program test_program
Could not load library libtest.0.1.a[shared_object.o]
Error was: No such file or directory
Apparently, the loader can't find the library at run-time. How
do you tell it where to look? It seems that this might involve
putting a special line in the export.list that starts with #!,
but I'm not sure exactly. Can someone help me? The ld man page
is very vague on this subject.
Thanks in advance,
Andy
More information about the Comp.unix.aix
mailing list