0

I have a command line like this:

$ gcc -shared -fPIC procmem.c -o libprocmem.so

But i don't know what -shared and -fPIC mean? Can someone explain it to me. Thank you.

A.H.John
  • 49
  • 4
  • 3
    Possible duplicate of [GCC -fPIC option](http://stackoverflow.com/questions/5311515/gcc-fpic-option) – Paul R Apr 20 '17 at 09:35
  • @PaulR what about shared ? – A.H.John Apr 20 '17 at 09:56
  • Possible duplicate of [How does gcc `-shared` option affect the output?](http://stackoverflow.com/questions/25084855/how-does-gcc-shared-option-affect-the-output) – Paul R Apr 20 '17 at 09:58
  • 2
    TL;DR: use `-shared -fPIC` when compiling shared libraries, so that code can be loaded at an arbitrary address at run-time. – Paul R Apr 20 '17 at 10:00

0 Answers0