HDF5 Reference Manual H5 H5A H5D H5E H5F H5G H5I H5P H5R H5RA H5S H5T H5Z Tools

# H5: General Library Functions

These functions serve general-purpose needs of the HDF5 library and it users.

- H5open
- H5close

- H5get_libversion
- H5check_version

- H5dont_atexit

Name: H5open
Signature:
  herr_t `H5open`(void)
Purpose:
  Initializes the HDF5 library.
Description:
  `H5open` initialize the library. This function is normally called automatically, but if you find that an HDF5 library function is failing inexplicably, try calling this function first.
Parameters:

None.

Returns:
  Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5close
Signature:
  herr_t `H5close`(void)
Purpose:
  Flushes all data to disk, closes file identifiers, and cleans up memory.
Description:
  `H5close` flushes all data to disk, closes all file identifiers, and cleans up all memory used by the library. This function is generall called when the application calls `exit`, but may be called earlier in event of an emergency shutdown or out of desire to free all resources used by the HDF5 library.
Parameters:

None.

Returns:
  Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5dont_atexit
Signature:
  herr_t `H5dont_atexit`(void)
Purpose:
  Instructs library not to install `atexit` cleanup routine.
Description:
  `H5dont_atexit` indicates to the library that an `atexit()` cleanup routine should not be installed. The major purpose for this is in situations where the library is dynamically linked into an application and is un-linked from the application before `exit()` gets called. In those situations, a routine installed with `atexit()` would jump to a routine which was no longer in memory, causing errors.

  In order to be effective, this routine must be called before any other HDF function calls, and must be called each time the library is loaded/linked into the application (the first time and after it's been un-loaded).

Parameters:

None.

Returns:
  Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5get_libversion
Signature:
  herr_t `H5get_libversion`(unsigned *`majnum`, unsigned *`minnum`, unsigned *`relnum` )
Purpose:
  Returns the HDF library release number.
Description:
  `H5get_libversion` retrieves the major, minor, and release numbers of the version of the HDF library which is linked to the application.
Parameters:

unsigned *`majnum`
  The major version of the library.
unsigned *`minnum`
  The minor version of the library.
unsigned *`relnum`
  The release number of the library.

Returns:
  Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5check_version
Signature:
  herr_t `H5check_version`(unsigned `majnum`, unsigned `minnum`, unsigned `relnum` )
Purpose:
Description:
  `H5check_version` verifies that the arguments match the version numbers compiled into the library. This function is intended to be called from user to verify that the versions of header files compiled into the application match the version of the HDF5 library.

  Due to the risks of data corruption or segmentation faults, `H5check_version` causes the application to abort if the version numbers do not match.

Parameters:

unsigned *`majnum`
  The major version of the library.
unsigned *`minnum`
  The minor version of the library.
unsigned *`relnum`
  The release number of the library.
unsigned *`patnum`
  The patch number of the library.

Returns:
  Returns a non-negative value if successful. Upon failure, this function causes the application to abort.

HDF5 Reference Manual H5 H5A H5D H5E H5F H5G H5I H5P H5R H5RA H5S H5T H5Z Tools

HDF Help Desk
Last modified: 27 October 1998