gcc -fPIC ਸਾਂਝੀਆਂ ਲਾਇਬ੍ਰੇਰੀਆਂ ਲਈ ਸਥਿਤੀ ਸੁਤੰਤਰ ਕੋਡ (PIC) ਤਿਆਰ ਕਰਦਾ ਹੈ।
$ gcc -fPIC [options] [source files] [object files] -o output file
ਪਲੇਟਫਾਰਮ ਕੰਪਾਈਲਰ ਦੁਆਰਾ ਸਮਰਥਿਤ ਹੋਣ 'ਤੇ ਵਧੇਰੇ ਕੁਸ਼ਲ ਕੋਡ ਬਣਾਉਣ ਲਈ -fPIC ਦੀ ਬਜਾਏ -fpic ਦੀ ਵਰਤੋਂ ਕਰੋ।
ਸਰੋਤ ਫਾਈਲ myfile.c ਲਿਖੋ :
// myfile.c
#include <stdio.h>
int
myfunc()
{
printf("myfunc\n");
}
ਬਿਲਡ myfile.c myfile.o ਤਿਆਰ ਕਰਦਾ ਹੈ :
$ gcc -fPIC -c myfile.c
$