gcc动态库和静态库的使用

-Wl选项告诉编译器将后面的参数传递给链接器。 -rpath使得execute记住链接库的位置. -W -rpath=./调用当前文件中的.so文件
动态库
#include
#include"test2.h"
int main(void)
{
func_a();
struct St *s= func_b();
printf("hello/n");
// printf("%s/n",s.name);
return 0;
}

#include
#include "test2.h"
#include
struct St{
int id;
char *name;
};
void func_a(){
printf("FUNC_A/n");
}
struct St *func_b(){

gcc动态库和静态库的使用最先出现在Python成神之路

版权声明:
作者:lichengxin
链接:https://www.techfm.club/p/11053.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>