Last active
August 9, 2020 15:19
-
-
Save Kungergely/91586d5d0e941d3d8e1812a794cc59fc to your computer and use it in GitHub Desktop.
Detecting the version of the HDF5 library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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