An individual Fortran source file can be compiled to
an object (*.o
) file instead of to the final
program executable.
This allows several portions of a program to be compiled
at different times and linked together whenever a new
version of the program is needed.
However, it introduces the issue of object compatibility
across the various object files (and libraries, or *.a
files) that are linked together to produce any particular
executable file.
Object compatibility is an issue when combining, in one
program, Fortran code compiled by more than one compiler
(or more than one configuration of a compiler).
If the compilers
disagree on how to transform the names of procedures, there
will normally be errors when linking such programs.
Worse, if the compilers agree on naming, but disagree on issues
like how to pass parameters, return arguments, and lay out
COMMON
areas, the earliest detected errors might be the
incorrect results produced by the program (and that assumes
these errors are detected, which is not always the case).
Normally, g77
generates code that is
object-compatible with code generated by a version of
f2c
configured (with, for example, f2c.h
definitions)
to be generally compatible with g77
as built by gcc
.
(Normally, f2c
will, by default, conform to the appropriate
configuration, but it is possible that older or perhaps even newer
versions of f2c
, or versions having certain configuration changes
to f2c
internals, will produce object files that are
incompatible with g77
.)
For example, a Fortran string subroutine
argument will become two arguments on the C side: a char *
and an int
length.
Much of this compatibility results from the fact that
g77
uses the same run-time library,
libf2c
, used by f2c
,
though g77
gives its version the name libg2c
so as to avoid conflicts when linking,
installing them in the same directories,
and so on.
Other compilers might or might not generate code that
is object-compatible with libg2c
and current g77
,
and some might offer such compatibility only when explicitly
selected via a command-line option to the compiler.
Note: This portion of the documentation definitely needs a lot of work!