天天看点

linux下C语言编程动态库so的编写及调用

编译步骤

gcc test_a.c test_b.c -fpic -shared -o libtest.so

gcc test.c -l. -ltest -o test

./test

解决链接库问题:

#vim /etc/profile

ld_library_path=/mnt/hgfs/ubuntu_shared/so:$ld_library_path

export ld_library_path

# source /etc/profile

继续阅读