Production and use of static libraries
1. First generate the xxx.o file of the encapsulated function: gcc xxx.c -c
2. Then compile the xxx.o file into the static library file xxx.a ar rcs libxxx.a xxx.o
Remove the head lib when compiling and remove the tail.a -l link library -L specifies the library location
Production and use of dynamic libraries
First, generate the libxxx.so file by encapsulating the function gcc -shared -fpic xxx.c -o libxxx.so
Remove the head lib when compiling and remove the tail .so -l link library -L specifies the library location
If the dynamic library file cannot be found during runtime, you can put the generated libtou.so under /user/lib/