using iargc()/getarg() form C

Steve Kargl sgk@troutmask.apl.washington.edu
Tue Feb 22 19:42:00 GMT 2005


On Tue, Feb 22, 2005 at 01:24:30PM -0600, Satish Balay wrote:
> On Tue, 22 Feb 2005, Satish Balay wrote:
> > It appears that gfortran now has support for iargc()/getarg() from
> > fortran [by name transofrmation]. However Some mixed language codes
> > that support fortran - use these functions from C.
> > 
> > Is there a plan to provide the above symbols as well?
> > getarg_() -> _gfortran_getarg_i4()
> > iargc_()  -> _gfortran_iargc()
> 
> According to http://gcc.gnu.org/ml/fortran/2005-02/msg00141.html
> command_argument_count() and get_command_argument() are the correct
> things to use.

Both intrinsics are from Fortran 2003 and so are technically
extension to the Fortran 95 language.

I would certainly use these instead of iargc/getarg.

> How about providing the appropriate names as well instead of the
> modified ones? so this standard defined versions are easily detected
> and used from C as well?
> 
> command_argument_count__ -> _gfortran_get_command_argument_i4
> get_command_argument__   -> _gfortran_get_command_i4
> 

This probably won't happen.  What are we to do if someone
uses the -i8 option?   Should gfortran remap the C entry
point to the *_i8 gfortran procedures?

There is nothing stopping you from wrapping the gfortran
procedure in a C function.

-- 
Steve



More information about the Fortran mailing list