Tobias Schlüter wrote:
...
From your description, and from looking around the testcase from the
webpage, I take it that it's actually a linker problem that some people
used to work around in the weirdest ways. Creating an intermediate
library should not ever cause any differences.
It is not a linker problem per se. It is a semantic difference between:
gfortran -o myexe *.o
and
gfortran -o myexe mymain.o -lmylib # (where libmylib.a is an ar library)
In the former, the linker just links everything in the list of .o files
into myexe. Often without checking to see if the routine is actually
called.
In the latter, the linker notices there are unsatisfied externals from
mymain.o, then tries to find those externals in libmylib.a. It pulls
in the needed routines as found. Routines which are not in the call tree
are generally not included in myexe. (Again, we are NOT talking about
shared libs/dlls - which are essentially pre-linked in the *.o style.)