This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: using iargc()/getarg() form C
On Wed, Feb 23, 2005 at 08:24:12AM -0600, Satish Balay wrote:
> On Tue, 22 Feb 2005, Steve Kargl wrote:
>
> > kargl[221] cat gr.c
> > extern int _gfortran_iargc(void);
> > int iargc_(void)
> > {
> > return _gfortran_iargc();
> > }
> > kargl[222] cat foo.f90
> > program main
> > integer i
> > i = iargc()
> > print *, i
> > end
Whoops. I sent the wrong foo program. Try this one.
program main
integer i, iargc
external iargc ! This line is important.
i = iargc()
print *, i
end
troutmask:kargl[220] /usr/tmp/sgk/bin/gfc -o foo -static foo.f90
/var/tmp/cc8VmR4v.o(.text+0x9): In function `MAIN__':
: undefined reference to `iargc_'
collect2: ld returned 1 exit status
troutmask:kargl[221] /usr/tmp/sgk/bin/gfc -o foo -static foo.f90 gr.o
troutmask:kargl[222] ./foo 1 2 3
3
troutmask:kargl[228] /usr/tmp/sgk/bin/gfc -static -c foo.f90
troutmask:kargl[229] nm foo.o
0000000000000000 T MAIN__
U _gfortran_filename
U _gfortran_ioparm
U _gfortran_line
U _gfortran_st_write
U _gfortran_st_write_done
U _gfortran_transfer_integer
U iargc_
--
Steve