Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!bloom-beacon!snorkelwacker!ai-lab!dead!ead.dsa.com!schorr From: schorr@ead.dsa.com (Andrew J. Schorr) Newsgroups: comp.unix.aix Subject: Making shared libraries Message-ID: <1990Oct11.160027@ead.dsa.com> Date: 11 Oct 90 20:00:27 GMT Sender: news@ead.dsa.com Reply-To: schorr@ead.dsa.com (Andrew J. Schorr) Organization: Daiwa Securities America, New York Lines: 33 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