[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: updated pdf library
- From: Daniel Silverstone <dsilvers@...>
- Date: Fri, 1 Aug 2003 14:22:38 +0100
On Fri, Aug 01, 2003 at 10:13:18AM -0300, Luiz Henrique de Figueiredo wrote:
> >You should compile your code -fPIC -DPIC if you intend to link it into a
> >shared object.
> You're right of course. I took the lazy route. Sorry about that. I'll fix it
> next time I update one of the libraries.
*grin*
> On the other hand, if you're interested in adding one of my libraries to your
> own host program, you may also link it statically, though the .so route I took
> is the easiest for testing. However, in this case you probably do *not* want
> a .o compiled with fPIC -DPIC. So, I just avoid this whole issue... :-)
The way I tend to manage this is I compile everything twice. First
without (linking into a .a using ar and ranlib) and then again with,
linking into a .so
E.g.
SOURCES := foo.c bar.c
OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
SOBJECTS := $(patsubst %.c,%.os,$(SOURCES))
LIB := sponge
lib$(LIB).a: $(OBJECTS)
ar and ranlib
lib$(LIB).so: $(SOBJECTS)
gcc with -shared
%.o: %.c
compile without -fPIC -DPIC
%.os: %.c
compile with -fPIC -DPIC
I hope that helps
D.
--
Daniel Silverstone http://www.digital-scurf.org/
Hostmaster, Webmaster, and Chief Code Wibbler Digital-Scurf Unlimited
GPG Public key available from keyring.debian.org KeyId: 20687895
Is that really YOU that is reading this?