Igor XOP Issues Linking the HDF5 Library

Hello,

I've been developing an XOP operation, and wanted to introduce file IO functionality from the HDF5 library. To ensure I could access the library, I created a simple H5::IntType variable. I have no compile errors when adding the dependencies with the Visual Studio project properties like so:

  • C/C++ > General > Additional Include Directories = $(HDF5)\include
  • Linker > General > Additional Library Directories = $(HDF5)\lib
  • Linker > Input > Additional Dependencies = hdf5.lib; hdf5_cpp.lib

However, when I run Igor and call the XOP, I get the following error:

This is strange because the XOP was working with other dlls I incorporated into the project using the same methods. I have all dll dependencies in the same directory as the XOP (Igor Extensions (64-bit)) (including hdf5.dll and hdf5_cpp.dll). I also have the H5_BUILT_AS_DYNAMIC_LIB preprocessor definition set. This has worked for all my other projects so far, yet there is nothing I have found will work with Igor and the HDF5 library. The one thing I did find strange was the H5Fis_accessible entry point exists in hdf5.dll (not hdf5_cpp.dll as the Igor error message states) examining the dlls with the Visual Studio dumpbin command. I have ruled everything else out, as the XOP operation completes successfully when I comment out the single reference to the HDF5 library.

I figure that Igor also uses the HDF5 library, and this could be some conflict with HDF5 library versions? But I'm a bit stuck on how to proceed here. Any suggestions are much appreciated!

Some more details:

  • I am using version 1.12.1 of the HDF5 library
  • I am using Igor Pro 9 x64
  • I am working on the XOP in Visual Studio 2022 on Windows 11
  • I have tried adding the H5_BUILT_AS_DYNAMIC_LIB preprocessor definition to the build and placing both hdf5.dll and hdf5_cpp.dll in the same directory as the XOP

Starting with Igor Pro 9, Igor's HDF5 support is built in and the Igor HDF5 library files ship in the folder containing the Igor64.exe application file.

I think your XOP is dynamically linking with Igor's hdf5.dll library. This is version 1.10.7 which does not have the H5Fis_accessible function which, I believe, was added in 1.12.

I have all dll dependencies in the same directory as the XOP

The XOP manual says:

Igor loads Windows XOPs using the Windows OS LoadLibraryEx routine with the LOAD_WITH_ALTERED_SEARCH_PATH flag. This means that the OS will look for DLLs required by the XOP in the folder containing the XOP before looking elsewhere. You can ship a DLL that your XOP depends on in the same folder as the XOP and no further installation is required of the end user. This technique is explained at http://msdn.microsoft.com/en-us/library/ms682586(VS.85).aspx

I think this is not working because the hdf5.dll library is already loaded so Windows does not search for it.

One solution is to use the hdf5 libraries included with Igor. The documentation for version 1.10 is here.

The only other option is for you to link statically with the hdf5 libraries. The HDF5 download web page says "Static libraries begin with lib and shared libraries do not. For example, hdf5.lib is the shared library and libhdf5.lib is the static library" so apparently static libraries are included with the precompiled libraries.

In reply to by hrodstein

This resolved my issue, I greatly appreciate the help! It's good to know that Igor uses version 1.10. I was thinking along those lines, but I had completely missed the hdf5 static libraries.

Thanks again!

In reply to by hrodstein

hrodstein wrote:

One solution is to use the hdf5 libraries included with Igor. The documentation for version 1.10 is here.

I don't recommend doing this. We make no promises that Igor will ship with any given version of the HDF5 library or that it will ship with libraries that can be used by third-party applications. If we decided to upgrade or change the HDF5 libraries that ship with Igor that might break your XOP.