Micha Feigin (michf@math.tau.ac.il) wrote:
> How do I compile and use both static and dinamic libraries under linux?
Static:
gcc -c foo.c
gcc -c bar.c
ar rv libfoo.a foo.o bar.o
Dynamic:
gcc -c -fpic foo.c
gcc -c -fpic bar.c
gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0 foo.o bar.o
You can also use GNU libtool if you're feeling brave.
> Any good tutorial on the subject?
Static libraries are standard -- any Unix development tutorial will work.
Dynamic libraries follow the ELF standards, so any document discussing
ELF should be a good starting point. The LINUX-ELF HOWTO is great,
but it's kind of obsolete (*nobody's* using a.out any more), so it's
hard to find these days. I used google and managed to turn up a copy
at <http://www.linuxhq.com/HOWTO/ELF-HOWTO.html>.
--
Greg Wooledge | Distributed.NET http://www.distributed.net/
wooledge@kellnet.com | because a CPU is a terrible thing to waste.
http://www.kellnet.com/wooledge/ |