This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Linux Shared Libraries - How to create?
- To: Marcos Barreto de Castro <mbdecastro at yahoo dot com>
- Subject: Re: Linux Shared Libraries - How to create?
- From: Alexandre Oliva <oliva at lsd dot ic dot unicamp dot br>
- Date: 06 Dec 1999 17:27:45 -0200
- Cc: gcc at gcc dot gnu dot org
- References: <19991206183801.19642.qmail@web1501.mail.yahoo.com>
On Dec 6, 1999, Marcos Barreto de Castro <mbdecastro@yahoo.com> wrote:
> Which are the steps I need to perform in order to
> create a shared library under Linux?
Compile the source files with `gcc -c -fPIC', then link them with `gcc
-shared'. Or you may want to try GNU libtool.
> After I create it, how can I compile and link a
> program to use the shared library just created?
If the library name is libfoo.so, just link the program with -lfoo or
libfoo.so. You may have to specify -L/pathname for the library to be
found.
> Do I have to mention the library in the Makefile?
You don't really need a Makefile. If you want to use one, you may
want to take a look at GNU automake, that is well integrated with
libtool and makes the creation of shared libraries quite easy.
> Could anyone provide me with examples of the whole
> process?
The libtool manual is full of such examples.
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them