dynamic module loader

Hello all,

I have now written a simple external module loader for HDF5, the sources are attached. It consists of only two functions that should be called by H5_init_library() and H5_term_library(), respectively. It also adds two new API-functions to introspect what external modules have been loaded.

What this does, is to search some standard directories for modules which are defined to be shared libraries that export a given set of functions, and load them using the libdl. For each valid module, the init function is called which allows the module to register a filter with the library, for example. Note that this means, that a module could register anything with HDF5, not just filter callbacks. It is also possible for a module to register more than just one filter.

So, with this module loader included in HDF5, reading a file compressed with a nonstandard filter simply means to download the corresponding module, install it into the right directory and restart the program to read the file.

The module loader has been developed and tested under Linux, and its only added dependency is the libdl. Other systems should provide at least similar functionality so porting, if necessary, should be easy. Independent of portability, this code adds the ability to load general dynamic modules into HDF5, at least significantly increasing its flexibility under Linux systems.

An example test module is included in the attached archive, together with a Makefile to build the module. The module loader itself needs to be added to HDF5's build system along with its libdl dependency, and two calls have to be inserted into H5_init_library() and H5_term_library() to make it functional.

Best regards,
Nathanael Hübbe

h5externalModuleLoader.tar.gz (4.9 KB)