Progress working towards [NCF-329]

This commit is contained in:
Ward Fisher 2015-04-21 13:52:43 -06:00
parent 522cf5c6ec
commit 4c07e22ae4
3 changed files with 28 additions and 4 deletions

View File

@ -461,9 +461,8 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
# Find out if HDF5 was built with parallel support.
# Do that by checking for the targets H5Pget_fapl_mpiposx and
# H5Pget_fapl_mpio in ${HDF5_LIB}.
CHECK_LIBRARY_EXISTS(${HDF5_hdf5_LIBRARY} H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIPOSIX)
CHECK_LIBRARY_EXISTS(${HDF5_hdf5_LIBRARY} H5Pget_fapl_mpio "" HDF5_IS_PARALLEL_MPIO)
CHECK_LIBRARY_EXISTS(hdf5 H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIPOSIX)
CHECK_LIBRARY_EXISTS(hdf5 H5Pget_fapl_mpio "" HDF5_IS_PARALLEL_MPIO)
IF(HDF5_IS_PARALLEL_MPIPOSIX OR HDF5_IS_PARALLEL_MPIO)
SET(HDF5_IS_PARALLEL ON)
ENDIF()
@ -483,6 +482,9 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
ENDIF(NOT MSVC)
CHECK_LIBRARY_EXISTS(hdf5 H5free_memory "" HDF5_HAS_H5FREE)
# Assert HDF5 version.
SET(HDF5_VERSION_REQUIRED 1.8.10)
@ -549,6 +551,20 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
ENDIF()
SET(USE_ZLIB ON)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
##
# Check to see if libhdf5 contains
# 'H5free_memory'.
##
# CHECK_C_SOURCE_COMPILES("
# #include <hdf5.h>
# int main() {H5free_memory(NULL);}" HDF5_HAS_H5FREE)
# CHECK_SYMBOL_EXISTS(H5free_memory "H5public.h" HDF5_HAS_H5FREE)
# CHECK_LIBRARY_EXISTS(hdf5 H5free_memory "-L${HDF5_hdf5_LIBRARY}" HDF5_HAS_H5FREE)
# MESSAGE(STATUS "HDF5_HAS_H5FREE: ${HDF5_HAS_H5FREE}")
ENDIF()
# Option to Build DAP Client

View File

@ -88,6 +88,7 @@ are set when opening a binary file on Windows. */
#cmakedefine USE_FFIO 1
#cmakedefine USE_PARALLEL_POSIX 1
#cmakedefine USE_PARALLEL_MPIO 1
#cmakedefine HDF5_HAS_H5FREE 1
#cmakedefine USE_PARALLEL 1
#cmakedefine USE_PNETCDF 1
#cmakedefine USE_MMAP 1

View File

@ -1284,12 +1284,19 @@ read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char *type_name)
}
#ifndef JNA
/* Free the member name (which HDF5 allocated for us). */
/* On Windows using the microsoft runtime, it is an error
for one library to free memory allocated by a different library. */
for one library to free memory allocated by a different library.
IF it is available, we should use H5free_memory*/
#ifdef HDF5_HAS_H5FREE
if(member_name != NULL) H5free_memory(member_name);
#else
#ifndef _MSC_VER
if(member_name != NULL) free(member_name);
#endif
#endif
#endif
member_name = NULL;
}