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

海湾合作委员会
°• CmtoInchesConvert.com •°