This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: library
- From: Scott Robert Ladd <coyote at coyotegulch dot com>
- To: Laczó Tibor <laczo dot tibor at pro dot hu>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 14 May 2003 10:30:32 -0400
- Subject: Re: library
- References: <E19Fu9w-0006Xk-00@wakumbi.prim.hu>
Laczó Tibor wrote:
How can I make a shared library file, from objects files (.o) which
program should i use, with which flags?
Compile your .c source files with the -fPIC option:
gcc -c -fPIC -o snafu.o snafu.c
This generates "Position Independent Code", ready for inclusion in a
shared object library using a command like:
gcc -shared -fPIC -o libfu.so snafu.o fubar.o
That syntax informs the linker to generate a shared library (without
-shared, it creates an executable image).
--
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
Professional programming for science and engineering;
Interesting and unusual bits of very free code.