Skip to content

Instantly share code, notes, and snippets.

@Kungergely
Last active August 9, 2020 15:19
Show Gist options
  • Save Kungergely/91586d5d0e941d3d8e1812a794cc59fc to your computer and use it in GitHub Desktop.
Save Kungergely/91586d5d0e941d3d8e1812a794cc59fc to your computer and use it in GitHub Desktop.
Detecting the version of the HDF5 library
import ctypes
lib=ctypes.windll.LoadLibrary("C:\\Path\\to\\hdf5.dll")
#lib=ctypes.cdll.LoadLibrary("/usr/lib/libhdf5.so")
length = 1
majnum = ctypes.cast(ctypes.create_string_buffer(length), ctypes.POINTER(ctypes.c_uint))
minnum = ctypes.cast(ctypes.create_string_buffer(length), ctypes.POINTER(ctypes.c_uint))
relnum = ctypes.cast(ctypes.create_string_buffer(length), ctypes.POINTER(ctypes.c_uint))
lib.H5get_libversion.argtypes = [ ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)]
lib.H5get_libversion(majnum, minnum, relnum)
print "HDF5 library version: "+str(majnum.contents.value)+"."+str(minnum.contents.value)+"."+str(relnum.contents.value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment