[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic libs example code



> > Hmm, I don't know what article you refer to, but making shared libraries
> > is not difficult. Basically you need to make sure the code is compiled
> > with the switch '-fpic' and the library is finally linked with the switch
> > '-shared'. Such as:
> >
> > gcc -fpic -c Part1.c
> > gcc -fpic -c Part2.c
> > gcc -shared -o MyLib.so Part1.o Part2.o -lOtherNeededLib
> 
> I was wondering if anybody could illuminate me about those -fpic
> flags... The man pages are quite cryptic about them. The libraries I
> tried seems to work even *without* this flag (both in regular "-l" usage
> and using dlopen), and anyway, what ARE "large displacement branches"
> (the thing -fPIC is about)?
> 
> When should I use -fPIC rather than -fpic? Depends on the platform? Why
> doesn't it make any difference when I do not use those flags?

ELF HOW-TO:
ftp://tsx-11.mit.edu/pub/linux/docs/HOWTO/ELF-HOWTO



-- 
Marcelo Elias Del Valle    UIN: 30595143
marceloelias@iname.com http://tilt.8m.com
Já visitou o gamesnow hoje?
gamesnow@egroups.com  http://members.xoom.com/games_now

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GE  d-  s+:+   a--   C++>$  UL P+ L+++ E W+ N+ o- K  w-- O-- M+ V- PS++
PE(+)
Y+ PGP t+ 5? X R+ tv- b+ DI++ D++ G  e- h r(-) z+
 ------END GEEK CODE BLOCK------