using iargc()/getarg() form C

Satish Balay balay@fastmail.fm
Wed Feb 23 20:49:00 GMT 2005


On Wed, 23 Feb 2005, Steve Kargl wrote:

> On Wed, Feb 23, 2005 at 01:56:17PM -0600, Satish Balay wrote:
> > On Wed, 23 Feb 2005, Steve Kargl wrote:
> > 
> > I guess I understand this code - but this usage is not relavant to to
> > the stated problem. Its relavant only if the wrapper code is in
> > gfortran library.
> > 
> 
> I guess I don't understand your stated problem.  You're
> trying to use a Fortran runtime library routine that 
> requires initialization via the Fortram main_ entry point,
> which isn't used unless you link with gfortran.

If you look at the sample code I posted earlier
http://gcc.gnu.org/ml/fortran/2005-02/msg00277.html

The entry point is fortran - but calls to iargc_() are from C. This
mode is used for example by MPICH [discussed in an earlier thread] to
support MPI fortran bindings. And the hope was that packages like
MPICH shoudn't need patches to work with gfortran [when distributions
transition from gcc3 to gcc4]

The problem was clarified again at:
http://gcc.gnu.org/ml/fortran/2005-02/msg00288.html

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'

i.e foobar [=> foobar_i4]
    foobar_i8 [separate symbol to support -i8]

currently you have;
    foobar_i4
    foobar_i8

gfortran can do all the correct things in such a case aswell. [for all
fortran code with -i4 or -i8]

Satish



More information about the Fortran mailing list