Given an HDF5 library, how can I determine which version of HDF5 is being used (linked)?

Use one of the following to get the H5_VERS_INFO string as defined in H5public.h.:

% strings libhdf5.a | grep "HDF5 library version:"
% strings a.out | grep "HDF5 library version:"

This method works even if the a.out file is "stripped", and even if the binary file is not produced by the host machine.


Given a library that calls HDF5 functions, how can I determine which version of HDF5 was used to build it?

Add the following line to the calling library source, e.g., xyz.c.

  /* C automatically merges two adjacent strings into one. */
  /* Use non static char string so that it is included always. */
  char     XYZ_built_with_H5_lib_vers_info_g[] = "XYZ built with " H5_VERS_INFO;

Rebuild the library and then the following commands will show the information:

% strings libxyz.a | grep "HDF5 library version:"
 XYZ built with HDF5 library version: 1.4.4