The purpose of this post is to summarize the procedure to make personal library of routines so that re-use previous works.
(1) Fortran library to be used in Fortran
(2) C/C++ library to be used in C/C++
(3) Fortran library to be used in C/C++
(4) C/C++ library to be used in Fortran
(5) Fortran library to be used in Python
(6) C/C++ library to be used in Python
Let us start from the first/second case.
(1) to make a static library use "ar crvs"
ar rc liball.a dog.o cat.o bird.o #rc=replace/create
ranlib liball.a # make symbol indexing or use "s" for ar
to usegcc main.c -L -l<filename>
(2) to make dynamic/shared library use linker like "gcc" ,"gfortran"
gcc -g -fPIC -Wall -Werror -Wextra -pedantic *.c -shared -o liball.so
to use dynamic librarygcc -g -wall -o app app.c liball.so
* if source file *.f use .mod file, one have to keep them to make shared library.