gcc -fPIC genererar positionsoberoende kod (PIC) för delade bibliotek.
$ gcc -fPIC [options] [source files] [object files] -o output file
Använd -fpic istället för -fPIC för att generera mer effektiv kod, om det stöds av plattformskompilatorn.
Skriv källfilen myfile.c :
// myfile.c
#include <stdio.h>
int
myfunc()
{
printf("myfunc\n");
}
Build myfile.c genererar myfile.o :
$ gcc -fPIC -c myfile.c
$