how to create shared libraries with gcc/g++ and ld

how to create shared libraries with gcc/g++ and ld

Post by Ronald van Lo » Fri, 23 Jul 1993 18:23:33

Can anyone explain to me how I can create shared libraries for Linux ? I am
aware of the -fpic and -fPIC flags of gcc, as well as the -shared option to
the linker, but can anyone give me an example of actual use ? What's the trick ?

Thanks! (Please CC: me a copy as well as follow-upping)
Ronald van Loon     | In theory, there is no difference

3DCV Group, Utrecht |  
The Netherlands     | In practice however, there is.


1. Shared libraries and GNU GCC using gas and gnu ld.

After transferring all that GNU software to my computer and after
installing the GNU compiler, i wanted to install G++. Finally
i got it to compile on my 386 running ESIX. In order to make
it run best, the G++ people recommended using the GNU binutils,
which i did. You have to abandon COFF and use BSD style libraries.
I converted all my libs (including /usr/lib/libnsl_s). My problem
is now, that X programs do not compile any more because they can't
find the symbols that are defined in nsl_s! This appears to be
a shared library. I can think about two ways of getting my X soft-
ware to run with the GNU CC:
   1. Convert nsl_s to non-shared format. How do i do this??
   2. Maybe shared libs ARE supported in BSD style libs and i just
      don't know how. libconvert and robotussin can convert libnsl_s.a
      to BSD style (format). At link time however, the symbols defined
      there are not there for gcc-ld.

Maybe somebody also know if InterViews from the X11R4 distr. tape
runs under Esix Sys/V X11R3 (when comes Esix X11R4 ???) using G++?

Thanks a lot

P.S. Post to me, i'll summarize, if xedit lets me.

2. Exiting X -> nice black-on-black text on all VC

3. gcc, ld, function pointers, and shared libraries

4. Ultra33 Support - Any News?

5. How do you create shared libraries with gcc on AIX 4.3

6. Seyon Terminal Emulator Problems

7. Creating a shared library using gcc on Solaris?

8. Very strange behavour of pop3d

9. help with ld script to build iBCS shared library (gnu ld 2.2)

10. Creating a "shareable" library with ld.

11. Specifying libraries with gcc and/or ld

12. Puzzled by upgrading libraries (, gcc,, binutils)

13. gcc/ld default library search path.