This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

relocatable code and object files and shared libraries


Hi,
1)Are all object files are relocatable???

http://ehuss.com/shared/
The above  link says
"To create a shared library, you write the code like you normally
would. When you go to compile your code, you should indicate that the
code needs to be "position independent". You do this with the gcc
compile option "-fPIC". For example:

    gcc -fPIC -c my_library.c "

2) If we dont use -fPIC will the object file produced will not be relocatable??
3) What exactly does relocatable code means? any links explaning it please.
4) Why do we need shared library when we can create object files which
are relocatable??
5)Why the size of shared library file(*.so) is very large than the
object file from which it is produced??
Thanks in advance


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]