Making shared libraries

wlm at arnor.uucp wlm at arnor.uucp
Mon Oct 15 07:45:47 AEST 1990


Well, I think there are several ways of doing what you want.

First, shared things are looked for in /usr/lib and /lib (I forget the
order), so if you put that lib in one of those places, the system
will find it.

Second, I seem to recall that there is something like LIBPATH looked
for by the linker, and it looks in the places named. I don't recall
whether you have to say:
setenv LIBPATH
/lib:/usr/lib:/a/aragorn/homes/aragorn1/src/X11R4-new/mit/new-lib/X
or whether
setenv LIBPATH /a/aragorn/homes/aragorn1/src/X11R4-new/mit/new-lib/X is
sufficient.

Third, at link time, you can do something like:

cc -o ico -O ico.o
/a/aragorn/homes/aragorn1/src/X11R4-new/mit/new-lib/X/shared.\
o -L/a/aragorn/homes/aragorn1/src/X11R4-new/mit/new-lib/X -lm

where shared.o is a shared version of the R4 libX11.a. Using the -L flag
puts info in the load header of the resulting executable which allows
the loader to find the shared part when you try to run it.

Finally, there probably is a #![...] directive for the export file,
but I can't find the documentation for that stuff at the moment.

I would suggest judicious use of -L.

Bill Moran



More information about the Comp.unix.aix mailing list