UNIX下C语言编程动态库的生成
1.设计库代码
pr1.c
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 int p = 2; 2 void print() 3 { 4 printf("This is the first dll src !\n"); 5 }
pr2.c
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 int p = 3; 2 void print() 3 { 4 printf("This is the second dll src !\n"); 5 }
2.编绎
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 gcc -fpic -c pr1.c pr2.c 2 gcc -shared -o pr1.so pr1.o 3 gcc -shared -o pri2.so pr2.o