g77 compiles a main program unit, it gives it the public
libg2c library has the actual
as is typical of C-based environments, and
it is this procedure that performs some initial start-up
activity and then calls
libg2c are designed so that you need not
include a main program unit written in Fortran in your program--it
can be written in C or some other language.
Especially for I/O handling, this is the case, although
g77 version 0.5.16
includes a bug fix for
libg2c that solved a problem with using the
OPEN statement as the first Fortran I/O activity in a program
without a Fortran main program unit.
However, if you don't intend to use
f2c) to compile
your main program unit--that is, if you intend to compile a
procedure using some other language--you should carefully
examine the code for
libg2c, found in the source
gcc/libf2c/libF77/main.c, to see what kinds of things
might need to be done by your
main() in order to provide the
Fortran environment your Fortran code is expecting.
main() sets up the information used by
without providing a substitute for this activity would mean
GETARG would produce undefined
When debugging, one implication of the fact that
is the place where the debugged program "starts" from the
debugger's point of view, is in
libg2c is that you won't be
starting your Fortran program at a point you recognize as your
The standard way to get around this problem is to set a break
point (a one-time, or temporary, break point will do) at
the entrance to
MAIN__, and then run the program.
A convenient way to do so is to add the
to the file
.gdbinit in the directory in which you're debugging
After doing this, the debugger will see the current execution point of the program as at the beginning of the main program unit of your program.
Of course, if you really want to set a break point at some
other place in your program and just start the program
running, without first breaking at
that should work fine.