linux 静态库文件

时间:2023-03-09 23:10:55
linux 静态库文件

1、生成目标文件

  gcc -o mylib.o -c mylib.c

2、生成静态库文件

  ar rcs libmylib.a mylib.o

查看库信息:

  nm libmylib.a

//========================

//库信息如下:

bmp8_to_16.o:
00000978 T MApp_BmpDataReverse
00000000 t _convert_8_to_16
0000078c t _convert_8_to_16Buff
000001e0 T bmp_8bpp_to_16bpp
00000b08 T bmp_8bpp_to_16bppBuff
         U fclose
         U fopen
         U free
         U fseek
         U fwrite
         U malloc
         U memcpy
         U memset
         U printf

//=======================

引申:

1、生成目标文件

  mipsisa32-elf-gcc -c bmp8_to_16.c

2、生成静态文件

  mipsisa32-elf-ar crs ss.a  bmp8_to_16.o

后来考虑可能是与大端小端有关,默认是小端格式,而我们板子用的是大端格式

arm-linux-gcc -mbig-endian -o test test.c

gcc -mlittle-endian Hello_World.c
> or
> gcc -mlittle-endian Hello_World.c