UNIX下C语言编程动态库的生成

1.设计库代码

pr1.c

1 int p = 2;
2 void print()
3 {
4     printf("This is the first dll src !
");
5 }
View Code

pr2.c

1 int p = 3;
2 void print()
3 {
4     printf("This is the second dll src !
");
5 }
View Code

2.编绎

1 gcc -fpic -c pr1.c pr2.c
2 gcc -shared -o pr1.so pr1.o
3 gcc -shared -o pri2.so pr2.o
View Code
原文地址:https://www.cnblogs.com/sxmcACM/p/3986499.html