gcc -fPIC选项标志

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
$

 


也可以看看

Advertising

GCC
快速表格