[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Regarding Fortran Compiler Characteristics
From: |
Tobias Burnus |
Subject: |
Regarding Fortran Compiler Characteristics |
Date: |
Fri, 29 May 2009 18:12:02 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
Dear all,
I have a remark regarding the Fortran Compiler Characteristics section,
http://www.gnu.org/software/autoconf/manual/html_node/Fortran-Compiler.html
There one can find for AC_FC_MAIN/AC_F77_MAIN:
"As discussed above, many Fortran libraries allow you to provide an entry
point called (say) MAIN__ instead of the usual main, [...]"
That part is OK. However, it continues with
"Thus, when calling Fortran routines from C that perform things like I/O,
one should use this macro and declare the "main" function like so:
#ifdef __cplusplus
extern "C"
#endif
int F77_MAIN(int argc, char *argv[]);
"
I believe this does not make much sense. For instance, a minimal
Fortran example ("END") compiled with gfortran (4.5, -fdump-tree-original)
looks as follows. (Note: This is not C but the dump of the internal
structure of the compiler, but it is close to C.)
MAIN__ () {
(void) 0;
}
main (integer(kind=4) argc, character(kind=1) * * argv) {
static integer(kind=4) options.0[8] = {68, 255, 0, 0, 0, 1, 0, 1};
_gfortran_set_args (argc, argv);
_gfortran_set_options (8, &options.0[0]);
MAIN__ ();
return 0;
}
[At least for GCC Fortran (gfortran) there is also no need to call
_gfortran_set_args when doing I/O; it is only needed when accessing
the command line. (_gfortran_set_options might be in rare cases
useful when doing I/O, but only in very special cases; or for some
other special needs such as turning on the run-time bounds checking.
In any case that's out of scope for autoconf.)]
* * *
As the list below shows, most compilers do the initialization via a
special function, which makes more sense. I think it could be useful to
provide by default an AC_* macro, but at least the manual should be
changed.
gfortran has:
_gfortran_set_args (argc, argv);
g95 has:
g95_runtime_start(argc, argv);
NAG f95 uses:
f90_init(argc,argv);
Intel uses:
for_rtl_init_ (&argc, argv); /* Note the '&' */
g77 uses:
f_setarg(argc,argv);
Tobias,
who is a gfortran mainatainer
PS: I read that the "goal is that 2.64 will be released no later
than May 31st." Is this still the goal or when can 2.64 be
expected?
- Regarding Fortran Compiler Characteristics,
Tobias Burnus <=