changes to pnetcdf.h? (And other code files?)

Ed Hartnett ed at unidata.ucar.edu
Wed Aug 19 11:12:32 CDT 2009


Howdy all!

I would like to suggest some changes to pnetcdf.h.

The most important is to #ifndef two sections of the file that cause
problems when it is included with netcdf.h, the redefinition of nc_type
(which causes an error) and the redefinition of a lot of pre-processor
macros (which cause warnings).

The way to protect this is with:

#ifndef _NETCDF_
/* code to be protected here */
#endif

This allows me to include netcdf.h and then pnetcdf.h (since the
netcdf.h file defines _NETCDF_).

This is a very important change, and I hope you can get it into a
parallel-netcdf code release soon, because, until you do, I am going to
have to distribute my modified pnetcdf.h to allow netcdf-4 users to use
the parallel-netcdf library to write and read classic and 64-bit offset
files using parallel I/O.

So this is the only change I *NEED*, but while I am on the topic...

There is a large copyright notice from UCAR, but I believe none of the
pnetcdf.h file is covered by our copyright, because it is a different
API. So while an acknowledgement that it is based on netCDF from
UCAR/Unidata would be most welcome, I think it would be more reasonable
(and would make your lawyers happier) if you copyrighted the code for
Argonne, or whomever you want to give credit to. The current code is
quite misleading because it contains comments like this:

/*
 *	Copyright 1996, University Corporation for Atmospheric Research
 *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
 */

Another thing that can be removed from pnetcdf.h is the pre-processor
macros for building on windows:

/* Declaration modifiers for DLL support (MSC et al) */

#if defined(DLL_NETCDF) /* define when library is a DLL */
#  if defined(DLL_EXPORT) /* define when building the library */
#   define MSC_EXTRA __declspec(dllexport)
#  else
#   define MSC_EXTRA __declspec(dllimport)
#  endif
#else
#define MSC_EXTRA
#endif	/* defined(DLL_NETCDF) */

# define EXTERNL extern MSC_EXTRA

There is no reason to build parallel-netcdf within visual studio, so you
can just cut this right out.

Thanks!

Ed

-- 
Ed Hartnett  -- ed at unidata.ucar.edu


More information about the parallel-netcdf mailing list