This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Rick, > The attached gzipped tar file contains my implementation of new > FORTRAN interfaces that use the FORTRAN 2003 C interoperability facility > to replace your current C based wrapper routines with standard > conforming FORTRAN code. I don't know if anyone in the netCDF community > has done something similar. If they have, then you have another > implementation to compare against. I've tested the new interfaces with > the two compilers I have access to (CRAY X1 and g95) that support the > F03 C interop. facility. However, I would like to release it to the > netCDF community for further testing with compilers I don't have access > to (such as version 10 of IBM's xlf compiler for AIX and Linux). There > is a PDF in the tar file that describes the new interfaces and my > motivations for developing them. > > Let me know what you think and if this work is something UCAR is > interested in developing further. I'm *very* interested in this, as our cfortran.h approach is starting to become unmaintainable. I knew the Fortran standards group was proposing a standard way to call C funtions from Fortran, but I didn't know g95 and possibly other commercial compilers already implemented it. I'm embarrassed to admit I didn't even know Fortran 2003 was an approved standard. But now that I look at the Draft Standard at http://j3-fortran.org/doc/standing/2003/007.pdf I see it includes an "ISO C BINDING module" that portably solves the problem of invoking C from Fortran and vice-versa, and even provides portable mappings between C types and Fortran types. This is a great addition to standard Fortran! As far as I know, no one in the netCDF community has done anything like this, so you're the first. I encourage you to let people in the community know about this for testing. I would be very interested in finding out what compilers support the Fortran 2003 interoperability with C. We probably won't be able to abandon the cfortran.h approach until most of the compilers people use have this capability. We are about to make a 3.6.2 release. I see that the compressed tar you sent is a complete replacement for 3.6.1. [Ed: it's in /scratch/russ/netcdf-3.6.1-f03/]. Do you think it would be practical to maintain a set of patches so this could be applied to later releases than 3.6.1? Alternatively, maybe our autotools approach could detect whether the Fortran compiler supports C interoperability and use it in that case. This has the potential to eliminate a lot of the support questions we get about the Fortran-C interface with various compilers and development platforms. On behalf of the netCDF community, thanks for making this valuable development work available! --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu