Is there a way to use libtool to link against a library using dlopen? I want
to be able to link against a library which may not be present at runtime, be
certain that the application starts up (i.e. the dynamic linker doesn't
discover that a library is missing and abort), and then be able to find out
whether a given library was successfully linked or not (and hence decide
whether I can execute code that uses symbols from that library).
(I'm not quite clear, but perhaps doing this fully automatically is beyond
the scope of libtool and needs linker support?)
The use I have in mind is linking CODECs with different licenses into an
application without needing to change the code so that the CODECs are
dlopened. Then, if certain CODECs are not available, the application can
simply give an error message if the user attempts to use them, but the
application author doesn't need to write (or in this case, re-write) the
code to use dlopen.
If this isn't possible, is there a tool I can use to dlopen-ify my code for
a particular library or list of symbols or include file or similar?
I guess if none of this is possible then the easiest way may be to rewrite
the application's CODEC interface so that CODEC wrappers are themselves
shared objects which can be dlopened, which avoids rewriting the CODEC
wrappers. Then a failure to link a given CODEC wrapper when it is dlopened
indicates won't stop the application running.
Any technology distinguishable from magic is insufficiently advanced