 |
APIReference
|
|
Accessibility
Maintaining Compatibility with other HDF5 Library Versions
- Problem
- You want to ensure that the HDF5 files you produce or modify are accessible by all releavnt tools and applications
- Solution
- For HDF5 items (objects, attributes, etc.) that you would like to create in new or existing HDF5 files, ascertain the supported range of HDF5 library versions as lower and upper bounds. When creating new or opening existing HDF5 files, use a file access property list and configure the supported range via the H5Pset_libver_bounds() function.
In the example below, we restrict HDF5 item creation to the HDF5 1.8.x family of library versions.
16 __label__ fail_fapl, fail_file;
17 hid_t fapl, file, aspace, attr;
20 ret_val = EXIT_FAILURE;
23 #if H5_VERSION_GE(1, 10, 0)
25 #elif H5_VERSION_GE(1, 8, 0)
28 #error Only HDF5 1.8.x and later supported.
30 ret_val = EXIT_FAILURE;
34 ret_val = EXIT_FAILURE;
- Discussion
- See RFC Setting Bounds for Object Creation in HDF5 1.10.0 for a detailed and comprehensive account of HDF5 versioning (library, file format spec., etc.) and the H5Pset_libver_bounds() function.
The default range H5F_LIBVER_EARLIEST (low) - H5F_LIBVER_LATEST (high) offers the widest compatibility range, but may not be suitable for certain (feature-)use cases.
The HDF5 library comes with a forward- and backward-compatibility guarantee: This means that the latest version of the library can always read HDF5 files created by a version realesed earlier (backward compatibility). It also means that a given release of the library can read the contents of HDF5 files created with later versions of the library as long as the files do not contain features introduced in later versions (forward compatibility).
- See Also
- See the recipe Creating "Large" HDF5 Attributes for an example where we use HDF5 compatibility settings to enable the creation of large HDF5 attributes.
#define H5F_LIBVER_LATEST
Definition: H5Fpublic.h:195
herr_t H5Pclose(hid_t plist_id)
Terminates access to a property list.
hid_t H5Pcreate(hid_t cls_id)
Creates a new property list as an instance of a property list class.
int64_t hid_t
Definition: H5Ipublic.h:60
herr_t H5Fclose(hid_t file_id)
Terminates access to an HDF5 file.
#define H5P_DEFAULT
Definition: H5Ppublic.h:228
#define H5F_ACC_TRUNC
Definition: H5Fpublic.h:50
herr_t H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high)
Controls the range of library release versions used when creating objects in a file.
hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
Creates an HDF5 file.
#define H5P_FILE_ACCESS
Definition: H5Ppublic.h:64
@ H5F_LIBVER_V18
Definition: H5Fpublic.h:187