Re: [netcdfgroup] Determining format options available in netcdf library

  • To: "Gregory Sjaardema" <gdsjaar@xxxxxxxxxx>
  • Subject: Re: [netcdfgroup] Determining format options available in netcdf library
  • From: Ed Hartnett <ed@xxxxxxxxxxxxxxxx>
  • Date: Tue, 06 Sep 2011 11:24:08 -0600
"Gregory Sjaardema" <gdsjaar@xxxxxxxxxx> writes:

> OK, that was the only method I had come up with; I was hoping I was
> missing something.

With configure scripts, it's much preferable to be able to detect this
as compile-time, rather than having to actually run a program. The
reason is, for cross-compiles, one can compile but not run programs. 

To detect at compile-time, you could also check for the presence of
function nc_def_opaque, as I do in the configure script of the newly
separated fortran library.

Unfortunately, that will not work once we have addressed this issue:
https://www.unidata.ucar.edu/jira/browse/NCF-14 (provide reasonable
answers to netCDF-3 files for netCDF-4 functions). At that time,
nc_def_opaque, and all netcdf-4 functions, will be present in
classic-only builds of the library. 

In order to allow compile-time checking, I will have to add a dummy
function at that point, which will be found only in netCDF-4 enabled
builds, just like nc_def_opaque is now.

>>> I have an application that I want to normally write a classic netcdf-3
>>> file, but if the netcdf library was compiled with the netcdf-4 option
>>> enabled, it should create a netcdf-4 file.  It looks like the netcdf.h
>>> file is the same for both options and I don't see any api function that
>>> would give the information.

At runtime, calling nc_create with NC_NETCDF4 and checking the result is
your best bet.

Thanks,

Ed
-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx



  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: