Your program compiles correctly both with g77(gcc-3.4.4) and gfortran
(gcc-4.0.2). The gfortran executable is twice the size. Output is the
same. Changing iargc for command_argument_count and getarg for
get_command_argument the program works under gfortran but not under g77.
In the GAMESS code, iargc and getarg work, when compiled with gcc (C code)
and g77 (Fortran code) and linked with g77. All with gcc-3.4.4 and
earlier. The same code compiled and linked with gcc and gfortran
(gcc-4.0.2) give the same error in the linking stage with "undefined
reference to .." both for the iargc/getarg and the
command_argument_count/get_command_argument combinations.
The C code in GAMESS refers to the parallel execution control, while the
Fortran code refers to the computational chemistry part, which is the main
part.
Best regards
On Mon, 05 Dec 2005 16:41:55 -0600, Paul Thomas <paulthomas2@xxxxxxxxxx>
wrote:
Germund,
The following works with gfortran
[prt@localhost svn]# cat demo.f90
program test_arg
character(80) :: buffer
narg = iargc ()
print *, "no. of args = ", narg
do i = 1, narg
call getarg (i, buffer)
print *, buffer
end do
end program test_arg
[prt@localhost svn]# ./a.out my arg your arg
no. of args = 4
my
arg
your
arg
Whilst not standard (as using -std=f95 will demonstrate), this is a
fairly common manifestation of argument reading in fortran.
Regards
Paul Thomas
--
Dr. Germund Hojer
Depto. Fisica y Quimica Teorica
Facultad de Quimica
UNAM
germund.hojer@xxxxxxxxxxxxxxxx