- To: <netcdfgroup@xxxxxxxxxxxxxxxx>
- Subject: netcdf_f90.inc: a f90 friendly include file for the NetCDF Fortran 77 API
- From: "Arnaud Desitter" <arnaud.desitter@xxxxxxxxxxxxx>
- Date: Wed, 20 Apr 2005 10:47:13 +0100
Hi,
I attach "netcdf_f90.inc" which is similar to the standard "netcdf.inc" but
with Fortran interface blocks. It can be used with free- and fixed- format
source code.
For instance, in "netcdf.inc", distributed as part as the NetCDF library,
we have:
integer nf_create
! (character*(*) path,
! integer cmode,
! integer ncid)
external nf_create
The corresponding block in netcdf_f90.inc is:
interface
integer function nf_create &
& (path, &
& cmode, &
& ncid)
character*(*) path
integer cmode
integer ncid
end function
end interface
The only catch is NF_INT1_T and NF_INT2_T which, if netcdf_f90.inc
was included in the netcdf library, should be expanded to the right types
using probably m4 during the build process of netcdf.
So far, I used netcdf_f90.inc as below:
module my_netcdf
#if defined(HAVE_F90_NETCDF_INC)
# define NF_INT1_T integer(kind=1)
# define NF_INT2_T integer(kind=2)
# include 'netcdf_f90.inc'
#else
include "netcdf.inc"
#endif
end module my_netcdf
and uses "my_netcdf" to provide explicit interfaces to the Fortran 77
NetCDF API.
With the availability of free Fortran 95 compilers such as GNU gfortran,
interface blocks for the NetCDF Fortran 77 interface makes it possible
to benefit cheaply of interface checks in an existing code.
I hope it can be useful to somebody. It certainly helped me to find a few
bugs in my own codes.
Regards,
Attachment:
netcdf_f90.inc
Description: Binary data