Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Shared libraries
@ 1994-06-29  6:08 Emmett McLean
       [not found] ` <jerry.772874169@kenya>
  0 siblings, 1 reply; 7+ messages in thread
From: Emmett McLean @ 1994-06-29  6:08 UTC (permalink / raw)




  Attached below are instructions for making shared libraries
  on Sun OS4. Does anyone know what the equivalent instructions
  are on ULTRIX and OSF/1 using gcc?

  E-mail but feel free to post.

  Thanks,

  Emmett
 

   1.  Make for a subroutine/function:

      cc -PIC -c filename.c -o filename.o


   2.  Make the shared library (libtest.so.1.1)

      ld -o libtest.so file1.o file2.o file3.o -assert pure-text

      (Now rename libtest.so to libtest.so.1.1)

   3.  Linking the main program (make sure that libtest is in the LD_LIBRARY_PATH
   during runtime): 

      cc main.o -o a.out -L/yourlibdir -Bdynamic -ltest


\x1f


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

* Re: Shared libraries
       [not found] ` <jerry.772874169@kenya>
@ 1994-06-29 14:37   ` Burkhard Neidecker-Lutz
  0 siblings, 0 replies; 7+ messages in thread
From: Burkhard Neidecker-Lutz @ 1994-06-29 14:37 UTC (permalink / raw)


In article <jerry.772874169@kenya> jerry@tivoli.com (Jerry Frain) writes:
>emclean@sfsuvax1.sfsu.edu (Emmett McLean) writes:
>
>>  <lots of bogus stuff deleted>
>

First, the simple one:

	On ULTRIX, you can't produce or use shared libraries.
	End of story.

Second, the other simple one:

	On DEC OSF/1, you don't do anything special with GCC to
	create shared libraries. Read the section 3 of the Programmers
	Guide. Basically, you just create a normal library with all
	the normal flags you're used to. If you later decide that
	the library is to your liking:


		libfoo.a


	Then:

		ld -shared -no_archive -all libfoo.a -none -lc -o libfoo.so

	This example assumes that your shared library in turn is dependent
	only on the C library. If other libraries are needed in turn (say
	the math library), these go into the section after "-none".

		Burkhard Neidecker-Lutz

Distributed Multimedia Group, CEC Karlsruhe 
Advanced Technology Group, Digital Equipment Corporation
neideck@nestvx.enet.dec.com


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

* shared libraries
@ 1995-05-22  4:00 Stefan Monnier
  1995-05-22  4:00 ` David Metsky
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 1995-05-22  4:00 UTC (permalink / raw)


How do the .a libraries work ?
While explaining to a friend about the shared libraries, he pointed out to me
"you said all the standard libs were shared, but libc is a .a so it's not
shared". Of course he was right the libc is libc.a and libc.so, but still: it's
shared. So how does it work ?

~/tmp-0> cat test.c
main ()
{ printf("hello"); }
~/tmp-0> cc -o testtata -L. test.c -ltata
~/tmp-0> cc -o testc -L. test.c -lc
~/tmp-0> ls -AlF
total 218
lrwxrwxrwx   1 monnier  dilia         15 May 22 15:37 libtata.a@ -> /usr/lib/libc.a
-rw-r--r--   1 monnier  dilia         29 May 22 14:56 test.c
-rwxr-xr-x   1 monnier  dilia      23691 May 22 15:43 testc*
-rwxr-xr-x   1 monnier  dilia     187477 May 22 15:43 testtata*
~/tmp-0> 

Obviously libtata is the exact same thing as libc. Why is libc dynamically
linked whereas libtata is statically linked ? What's the point of .so libraries
then ?


	Stefan



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

* Re: shared libraries
  1995-05-22  4:00 shared libraries Stefan Monnier
@ 1995-05-22  4:00 ` David Metsky
  0 siblings, 0 replies; 7+ messages in thread
From: David Metsky @ 1995-05-22  4:00 UTC (permalink / raw)



In the first compile
	cc -o testtata -L. test.c -ltata
you specifically linked libc.a so you got the static case.

In the second compile
	cc -o testc -L. test.c -lc
you let the linker find the right version of libc.  It looks for the shared
version first in /usr/shlib and since it found it, that's what you got.

>Obviously libtata is the exact same thing as libc. Why is libc dynamically
>linked whereas libtata is statically linked ? What's the point of .so libraries
>then ?

libtata.a is the same as /usr/lib/libc.a, not the same as /usr/shlib/libc.so.
Your compile said to look in . first for libraries, and it found libtata.a
which is a link to /usr/lib/libc.a so that's what you got.  If you created
a libtata.so and made a symbolic link to /usr/shlib/libc.so, you would have
gotten the shared library.

By default, when a library is included on the link line by -lxxx, the linker
will look for the shared library first, and the static library second.  There
is a list of directories to scan for the library and /usr/shlib is the
first place it looks.  If you put a specific file on the link line, the 
linker will take that.
-- 
David Metsky	Digital UNIX Software Group      metsky@zk3.dec.com
-- 
David Metsky	Digital UNIX Software Group      metsky@zk3.dec.com



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

* Shared libraries
@ 1998-09-17  4:00 Peter Thornewell
  1998-09-18  4:00 ` Scott J. Tringali
  1998-09-18  4:00 ` Nikola Milutinovic
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Thornewell @ 1998-09-17  4:00 UTC (permalink / raw)


All,

How do I build a shared library under OSF1? The command/options etc (even
pointers to a good man page will work).

TIA,

Pete



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

* Re: Shared libraries
  1998-09-17  4:00 Shared libraries Peter Thornewell
@ 1998-09-18  4:00 ` Scott J. Tringali
  1998-09-18  4:00 ` Nikola Milutinovic
  1 sibling, 0 replies; 7+ messages in thread
From: Scott J. Tringali @ 1998-09-18  4:00 UTC (permalink / raw)


Peter Thornewell wrote:

> How do I build a shared library under OSF1? The command/options etc (even
> pointers to a good man page will work).

ld -shared <blah>
man ld



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

* Re: Shared libraries
  1998-09-17  4:00 Shared libraries Peter Thornewell
  1998-09-18  4:00 ` Scott J. Tringali
@ 1998-09-18  4:00 ` Nikola Milutinovic
  1 sibling, 0 replies; 7+ messages in thread
From: Nikola Milutinovic @ 1998-09-18  4:00 UTC (permalink / raw)


Peter Thornewell wrote:
> 
> All,
> 
> How do I build a shared library under OSF1? The command/options etc (even
> pointers to a good man page will work).

The command hor building libraries is "ld". Use the switch "-shared" and that
should work. See man pages.

man ld
man cc
man cxx
man -k library

Nix.





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

end of thread, other threads:[~1998-09-18  4:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-05-22  4:00 shared libraries Stefan Monnier
1995-05-22  4:00 ` David Metsky
  -- strict thread matches above, loose matches on Subject: below --
1998-09-17  4:00 Shared libraries Peter Thornewell
1998-09-18  4:00 ` Scott J. Tringali
1998-09-18  4:00 ` Nikola Milutinovic
1994-06-29  6:08 Emmett McLean
     [not found] ` <jerry.772874169@kenya>
1994-06-29 14:37   ` Burkhard Neidecker-Lutz

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