Sun Studio 12: Fortran Programming Guide

4.4.1 Tradeoffs for Static Libraries

There are three main issues to keep in mind regarding static, as compared to dynamic, libraries and linking:

Example: If the Fortran program is in two files, main.f and crunch.f, and only the latter accesses a library, it is an error to reference that library before crunch.f or crunch.o:


demo% f95 main.f -lmylibrary crunch.f -o myprog

(Incorrect)


demo% f95 main.f crunch.f -lmylibrary -o myprog    

(Correct)