using iargc()/getarg() form C

FX Coudert Francois-Xavier.Coudert@lcp.u-psud.fr
Wed Feb 23 22:01:00 GMT 2005


 > but calls to iargc_() are from C

Yes, and that means the C code using iargc_ is relying on the guts of a 
compiler (which is, of course, not a right thing to do). I know that 
this doesn't help you, but I sincerely think such code was modified in a 
portable way: as an example, declare a nargs variable, make sure both 
fortran and C code can access it, and at the beginning of the (fortran) 
code, call iargc (or f2003 equivalent) to set this nargs variable. Now, 
this should work whatever your (reasonnable) compiler is.

For the problem at stake, a choice has to be made about where we want to 
set the limit between useful compatibility and things that should go. 
Now, my opinion (and be aware that I'm no guru) is that having to export 
all kinds of compatibility symbols is not the way we want gfortran to 
go. If we wanted total source/binary compatibility, we're gonna end up 
nowhere (or we're gonna end up rewritting g77).

> My recomendation is to have non-changed names in the fortran library
> correspond to the default mode '-i4, -r4' - and mangled names for 'i8
> -r8'

In addition to what I stated above, this will not work on platforms 
where the default integer kind is not 4.

FX



More information about the Fortran mailing list