gcc -fPIC genererer positionsuafhængig kode (PIC) til delte biblioteker.
$ gcc -fPIC [options] [source files] [object files] -o output file
Brug -fpic i stedet for -fPIC til at generere mere effektiv kode, hvis det understøttes af platformens compiler.
Skriv kildefilen myfile.c :
// myfile.c
#include <stdio.h>
int
myfunc()
{
printf("myfunc\n");
}
Byg minfil.c genererer minfil.o :
$ gcc -fPIC -c myfile.c
$