When compiling a shared library with gcc / g ++, why -fPICnot the option -shared? Or, in another way, is there an option -fPICneeded for link time?
-fPIC
-shared
In short, I have to write:
gcc -c -fPIC foo.c -o foo.o gcc -shared -fPIC foo.o -o libfoo.so // with -fPIC
or enough:
gcc -c -fPIC foo.c -o foo.o gcc -shared foo.o -o libfoo.so // without -fPIC
, , , , , . -fPIC , GCC . , -shared, GCC . .
, . , , . . , , , .
, , , . , .
Source: https://habr.com/ru/post/1693285/More articles:Can I put my own dependencies in a subfolder - .net-coreHow to display a range of indices in a reaction? - javascriptCreating a new column for the reactive data block in the shiny / shiny panel R - rКак преобразовать Блестящее приложение, состоящее из нескольких файлов, в легкодоступный и воспроизводимый пример Shiny? - rHaskell syntax and semantics for character characters - haskellHow to write yaml file from dictionary using python? - pythonng build -w # ignore compilation errors without code - webpackDoes php have built-in array functions that can sort / assign values for a boolean result? - javascriptWhy is it not allowed to insert explicit values in HQL? - javaJUnit5 javadocs for offline use - javaAll Articles