ar rcs libexample.a file1.o file2.o 复制代码 链接静态库:在使用该静态库的项目中,需要将静态库链接到可执行文件中。可以在编译时指定静态库的路径和名称,例如: gcc -o example example.c -L. -lexample 复制代码 这样就可以手动创建一个Linux的静态库了。需要注意的是,静态库通常以lib开头,以.a为扩展...
创建静态库: ar -rcs test.a *.o 查看静态库: ar -tv test.a 解压静态库: ar -x test.a 查看程序依赖的动态库: readelf -a xxx|grep library 如:可以看到,下面的交叉程序hello执行依赖于如下两个动态库。 rebi@ubuntu:~/test$ arm-none-linux-gnueabi-readelf -a hello|grep "library" 0x00000001 ...
创建静态库: ar -rcs test.a *.o 查看静态库: ar -tv test.a 解压静态库: ar -x test.a 查看程序依赖的动态库: readelf -a xxx|grep library 如:可以看到,下面的交叉程序hello执行依赖于如下两个动态库。 rebi@ubuntu:~/test$ arm-none-linux-gnueabi-readelf -a hello|grep "library" 0x00000001 ...