flag ng opsyong gcc -fPIC

Ang gcc -fPIC ay bumubuo ng position independent code (PIC) para sa mga shared library.

Syntax

$ gcc -fPIC [options] [source files] [object files] -o output file

 

Gamitin ang -fpic sa halip na -fPIC upang makabuo ng mas mahusay na code, kung sinusuportahan ng platform compiler.

Halimbawa

Sumulat ng source file myfile.c :

// myfile.c
#include <stdio.h>
 
int myfunc()
{
    printf("myfunc\n");
}

 

Bumubuo ng myfile.c ang myfile.o :

$ gcc -fPIC -c myfile.c
$

 


Tingnan din

Advertising

GCC
°• CmtoInchesConvert.com •°