I know I can use dlopen can open shared libraries in C/C++.
I can use the result of the dlopen call to determine whether functionality exists.
However, I have a need to load the an existing library with many many functions.
Is there an alternative to redefining a long list of function pointer versions for all those functions and assigning each of them with dlsym?
One possible solution is to re-think things a little bit.
The shared optional library may be quite large, but if it is optional, then surely the
code you are writing to interface with it is also optional?
To cut down on the amount of dlsym() assignments you could write your own dynamic library which is linked against the optional library which implements ONLY THE OPTIONAL components.
You then dynamically load and assign only the optional components of your application from the non-optional portion of your application.
This may over-complicate things if your optional library is a C library and your optional components are C++ objects, but there you have it…