Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* How to make shared libraries ?
@ 1995-07-20  4:00 T.C. Zhao
  1995-07-21  4:00 ` Jonas Hvarfner
  1995-07-25  4:00 ` George Chaltas
  0 siblings, 2 replies; 3+ messages in thread
From: T.C. Zhao @ 1995-07-20  4:00 UTC (permalink / raw)


Wondering how to make a shared library. cc does not seem
to have the usual -PIC or some other telling flags. The ld man page 
mentioned using -shared would make a shared object 
(ld -shared -o libx.so *.o) , tried that, but when attempting to compile 
and link a program using the shared object, everything
seems ok, but when run, loader complains unable to mape the shared
library. Confused.

Any help would be appreciated.


-- 
                            |     I am Pentium of Borg.
T.C. -- Starving Physicist  |     Division is futile.
                            |     You will be Approximated.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to make shared libraries ?
  1995-07-20  4:00 How to make shared libraries ? T.C. Zhao
@ 1995-07-21  4:00 ` Jonas Hvarfner
  1995-07-25  4:00 ` George Chaltas
  1 sibling, 0 replies; 3+ messages in thread
From: Jonas Hvarfner @ 1995-07-21  4:00 UTC (permalink / raw)


In article <3ukf4i$903@uwm.edu>, T.C. Zhao <zhao@bloch.phys.uwm.edu> wrote:
>Wondering how to make a shared library. [ stuff deleted... ]

The following example shows how to make libXpm.so. Also check the information
given in the file /usr/shlib/so_locations.

ld -check_registry /usr/shlib/so_locations -shared -all \
-o libXpm.so *.o -none -lX11 -lc

ALL objects after -all is put in the .so-file, even if they are not needed.
-none switches of -all and only objects needed to resolve references are
ar added.

-check-registry can be omitted. Instead you can (but don't need to) copy
/usr/shlib/so_locations to ./ (where you have your *.o) and link without
-check_registry. ./so_locations will be checked and updated automatically.
(See the comments in /usr/shlib/so_locations.)

If your library is going to be put somewere else then in the standard
directories, i.e. /usr/shlib, you should add -soname /full/path/to/libname.so
(see loader(5)) in the ld-command above. Otherwise you'll have to link
with -rpath.

Hope this helps!

Regards,
		Jonas

-- 
Jonas Hvarfner					Dept. of Atomic Physics
hvarfner@msi.sunet.se				University of Stockholm



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to make shared libraries ?
  1995-07-20  4:00 How to make shared libraries ? T.C. Zhao
  1995-07-21  4:00 ` Jonas Hvarfner
@ 1995-07-25  4:00 ` George Chaltas
  1 sibling, 0 replies; 3+ messages in thread
From: George Chaltas @ 1995-07-25  4:00 UTC (permalink / raw)


There's nothing special (like -PIC) required in the compilation phase.

ld -shared *is* the correct way to link a shared library.  After you
link the library, set the environment variable LD_LIBRARY_PATH to
include the directory that contains the library.

-- 


		George Chaltas
		Digital Equipment Corporation
		chaltas@eng.pko.dec.com
		(508) 493-1117




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-07-25  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-07-20  4:00 How to make shared libraries ? T.C. Zhao
1995-07-21  4:00 ` Jonas Hvarfner
1995-07-25  4:00 ` George Chaltas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox