Re: g95 compilation of netcdf

Matthieu Verstraete <mjv500@xxxxxxxxxx> writes:

> Hello everybody,

Howdy!

>
> 1) I've managed to compile netcdf 3.5.1 3.6.0-p1 and a beta3.6.1 (not
> tested) with g95/gcc. I advocate using g95 as a f77 compiler instead
> of g77, which is less efficient and requires its own libraries. I have
> F90FLAGS=-fno-second-underscore FFLAGS=-fno-second-underscore FC=g95

The soon-to-be-announced next release of netCDF, 3.6.1, can build with
g95 out of the box, with no environment variables needed. (This is
also true for several other fortran compilers, including th f95,
formerly gfortran, now distributed with gcc.)

Starting with version 4.0, gcc includes a fortran 95 compiler, but it
is not the same as g95. My understanding is that they share some code,
but they are not the same thing. In any case, netCDF-3.6.1 will work
with either of them.

It's nice that there are now two free F95 compilers out there for
people to use!

>
> 2) I think there is a small bug in f90/netcdf_attributes.f90: I'm
> running on a 64 bit system (Athlon64 4000/FC4), and the default int
> for g95 is i8, whereas for C it's still i4. Netcdf finds this fine
> (fortran int = C long), but one of the interfaces in
> f90/netcdf_attributes.f90 is missing a typecast to standard int type:
>
> l.177
> nf90_put_att_one_FourByteInt = nf_put_att_int(ncid, varid, name, nf90_int,
>    1, valuesA)
>
> should be
>
> nf90_put_att_one_FourByteInt = nf_put_att_int(ncid, varid, name, nf90_int,
>    1, int(valuesA))
>
> Otherwise the 4byte valuesA is passed to a routine expecting a 8byte int.
> The same thing is already(correctly) done in the previous routine:
> nf90_put_att_FourByteInt = nf_put_att_int(ncid, varid, name, nf90_int,
>    size(values), int(values))

I will look into this...

>
> 3) It would be nice to have parameters in fortran/cfortran.h for g95
> and especially the intel compilers - they are not identified, and the
> default options are bad at linkage (still underscore problems).

The cfortran.h package is not a Unidata product - it is something we
use to wrap the C functions with fortran functions. It's web page is:
http://www-zeus.desy.de/~burow/cfortran/

However, I have managed to get 3.6.1 to pass all tests with the
current cfortran.h, so I think we have everything we really need
there.

Thanks, and keep on netCDFing!

Ed
-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx