main.o(.text+0x29e): undefined reference to `getarg_

Lars Segerlund lars.segerlund@comsys.se
Wed Feb 16 07:59:00 GMT 2005


 Why not make the g77 flag turn off all g95 ( and so on ) features ? 

 i.e. a strictly g95 mode ? 

 This way we wont get tons of old shitty code, kludged into g95 with common blocks
 and all, ;-D ..

 Anyway, from the beginning was not strict f95 the target ?

 / Lars Segerlund.


On Tue, 15 Feb 2005 10:02:37 -0800
Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:

> On Tue, Feb 15, 2005 at 09:03:15AM +0100, Daniel Heiserer wrote:
> > 
> > >>I downloded a ia32-linux binary from the gfortran page.
> > >>I found out why my example did not work:
> > >>c----------------
> > >>     PROGRAM test
> > >>     implicit none
> > >>     external getarg
> > >>     character*80    argv(50)
> > >>     integer*4       argc
> > >>     do argc=1,iargc()
> > >>        call getarg(argc,argv(argc))
> > >>       write(6,'(" Argument ",I2," is ",A)') argc, argv(argc)
> > >>     enddo
> > >>     END
> > >>c----------------
> > >>
> > >>The key point is the "external getarg" command. If I remove it it works.
> > >>I do not know if this defintion is an error on my side or if it is a bug 
> > >>of the compiler, but other f90/f77 compilers required it, and g77 as 
> > >>well as g95 got along with it.
> > >>
> > >
> > >
> > >"external getarg" tells the compiler that you are linking a
> > >user-defined external procedure.  "getarg" in gfortran is an
> > >intrinsic procedure if you use the -std=gnu option, which is
> > >the default.  If you use -std=f95, then "getarg" is not an
> > >intrinsic procedure, and gfortran would issue an error during
> > >the link stage because getarg_() would be missing if you do 
> > >not supply one.
> > 
> > I appreciate the fact that it is part of the delivery, but
> > as is there is no compatibility with other fortran compiler and g77.
> > 
> 
> What do the other fortran compilers do if you change 
> "external getarg" to "intrinsic getarg"?  If they compile
> the both codes, then IMHO something is wrong.  A procedure
> cannot be both an external and an internal procedure
> (again IMHO).
> 
> I'm also beginning to believe that backwards compatibility
> with g77 may be a mistake because of some of the choices 
> that author of g77 made.
> 
> -- 
> Steve



More information about the Fortran mailing list