Use libltdl to wrap around dynamically loaded modules
See https://www.gnu.org/software/libtool/manual/html_node/Using-libltdl.html#Using-libltdl
Libtool provides a small library, called libltdl, that aims at hiding the various difficulties of dlopening libraries from programmers. It consists of a few headers and small C source files that can be distributed with applications that need dlopening functionality. On some platforms, whose dynamic linkers are too limited for a simple implementation of libltdl services, it requires GNU DLD, or it will only emulate dynamic linking with libtool’s dlpreopening mechanism.
libltdl supports currently the following dynamic linking mechanisms:
- dlopen (POSIX compliant systems, GNU/Linux, etc.)
- shl_load (HP-UX)
- LoadLibrary (Win16 and Win32)
- load_add_on (BeOS)
- NSAddImage or NSLinkModule (Darwin and Mac OS X)
- GNU DLD (emulates dynamic linking for static libraries)
- libtool’s dlpreopen (see Dlpreopening)
libltdl is licensed under the terms of the GNU Lesser General Public License, with the following exception:
As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include it under the same distribution terms that you use for the rest of that program.