detecting and using hdf compiled with -DHAVE_NETCDF
Patrice Dumas
pertusus at FREE.FR
Fri Feb 17 06:06:31 EST 2006
Hello,
To avoid clashes with the netcdf symbols, hdf may be compiled with
-DHAVE_NETCDF. In that case instead of defining the symbols like
ncopen, it defines sd_ncopen. This allows to link a program with netcdf and
hdf at the same time. grads don't requires this as gradshdf and gradsnc
are different executables. However gdl requires that, and now in fedora
the interface with sd_ is used.
I think that grads should be able to use both interfaces. With configure,
it shouldn't be hard to detect that sd_ncopen is defined and not ncopen
when linking against hdf. The code should also be changed to call sd_
variants. I see 2 possibilities for that:
1) add a wrapper file that wraps the call to sd_ functions, like
int ncopen (....)
{
sd_ncopen(...)
}
And include the file if sd_ variants have been detected.
It is not intrusive, but adds a function call.
2) define a macro (for example HDFNAME) that translates a name to the
sd_ variant name.
If the sd_ variants are detected, the following macro is defined:
#define HDFNAME(name) sd_ # name
otherwise HDFNAME does nothing:
#define HDFNAME(name) name
And the code must be modified to call HDFNAME for each nc symbols, so
ncopen should be changed to HDFNAME(ncopen).
It requires to modify the code, but there is no additional function call.
Does it look right? What would you prefer?
--
Pat
More information about the gradsusr
mailing list