A version of the standard Unix library manager, called 'ar', is provided. It manages what it calls "archives" which are just collections of object modules. To create a library you need to compile the source files with the -c switch to produce one or more object files (.o). These can be put in a library like this:
Download the main program main.f , data gwn.txt , and subroutine avesd.f and maxmin.f
save avesd.f and maxmin.f to a folder e.g. "./temp"
g77 -c ./temp/*.f (avesd.o and maxmin.o were generated)
ar -r libmylib.a ./temp/*.o (libmylib.a generated and note the prefix should be 'lib' and the filename extension should be '.a'.)
ar -t libmylib.a (list the contents of this library)
g77 main.f -o main.exe libmylib.a (the library file in the current directory)
main.exe
* g77 main.f -o main.exe d:\qwerty\libmylib.a (the library file in the folder 'd:\qwerty')
*1. The generated libraries are best placed in the same directory where all the G77 libraries were placed during installation (\G77\LIB\).
*2. The libraries can be referenced in a G77 command line by the "-l" option followed (without a space) with the library _basic_ name without the extension ".A"
*3. g77 main.f -o main.exe -lmylib
[ref] https://www.cs.yorku.ca/~roumani/fortran/ftn.htm, readme1.txt in the folder G77 of Fort99.zip