[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fortran 2003 netCDF interfaces redux



Hi Rick,

>   I reworked the distribution I sent you last week to build the old
> Fortran interfaces by default. This should make patching for your next
> distribution a little easier. To get my interfaces, you will have to
> explicitly set -DFortran2003 on FPPFLAGS and CPPFLAGS. I modified the
> code in /fortran to add an #ifndef Fortran2003 to the source files. This
> is a minor mod for all the files except fort-v2compat.c. I had to add
> the ifndef around all the FCALL statements used by cfortran.h since I
> still need the c_ncxxx functions for my Version 2 interfaces. I also
> added one small C routine in fort-v2compat.c to support my Version 2
> interfaces. Its function is to return the C variable size for the imap
> conversion. Unfortunately, a C_SIZEOF function will not be added to the
> C interop facility until the next FORTRAN upgrade (scheduled for 2008).
> I've updated my PDF and READMEs to reflect this change.
> 
> Summarizing my changes.
> 
> 1. All of my code except for one routine in /nf_test is in the f03
> subdirectory. You now need to run my code through a preprocessor to
> toggle the new interfaces on/off based on if -DFortran2003 is set.
> 
> 2. Nothing in /libsrc or any other directories other
> than /fortran, /nf_test and the parent Makefile and rules.make in /src
> was touched
> 
> 3. The files in /fortran were modified to add the #ifndef Fortran2003
> test plus mods to fort-v2compat.c to make the c_ functions I need for my
> Version 2 interfaces either static or extern and add one new function.
> 
> 4. The parent Makefile in /src was modified to add the f03 directory to
> the target lists. rules.make was modified to add a F03GARBAGE macro to
> your clean and distclean targets. (Probably could have used your
> existing GARBAGE macro so change the Makefiles in /f03 and /nf_test
> accordingly if you like). 
> 
> 5. One new routine was added to nf_test that provides FORTRAN interfaces
> to the C utilities you use in nf_test.F and ftest.F. The Makefile was
> modified accordingly. Also fortlib.c was modified to add the #ifndef
> Fortran2003 test.
> 
>   Other than these changes, nothing else in the existing netCDF
> distribution was touched. 
> 
>  Attached is a new complete 3.6.1 version with my mods plus a small
> FORTRAN source file that can be used to test for FORTRAN 2003 C interop
> support in configure. I'll leave hacking configure up to you. I would
> just screw it up big-time if I tried to do it.

Thanks for reworking this.  Your changes will definitely make it
easier to incorporate this method of calling C from Fortran.  We
discussed whether it was possible to get your changes into 3.6.2, but
unfortunately we're currently too close to releasing that version to
make this addition.  We plan to integrate your approach into the next
release, netCDF 4.0. 

Also, I'd like to make your netcdf-3.6.1-f03-2.tgz available from our
collection of contributed software to help users who have problems
with cfortran.h on platforms that have the necessary Fortran-2003
support.  I've tentatively added a description of it and a link to
your PDF document "Experimental FORTRAN 2003 Interfaces for netCDF 3"
from the catalog of contributed software at:

  http://www.unidata.ucar.edu/software/netcdf/Contrib.html

under the entry "Fortran 2003 interface".  Please let me know if you
want any changes to the brief description there or would rather that I
not make it available this way before we integrate it into our
distribution.  If this is OK with you, I may also add a brief entry
under our "What's new with netCDF" web page to point to this
contribution.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu