Results 1 to 1 of 1
New to the forum -- looks like a great place to be I have an application that can optionally use a shared library to take advantage of the installed hardware. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-12-2011 #1
- Join Date
- Aug 2011
- Seattle, WA
Can failure to find a shared library be made a non-fatal error?
New to the forum -- looks like a great place to be
I have an application that can optionally use a shared library to take advantage of the installed hardware. If the hardware (and hence the appropriate .so) isn't present, I don't want the application to terminate, I just want the functionality handled in a different way.
I have had success with two different ways of making this work, but both are what I would (snobbishly) consider inelegant: (1) creating a "stub" shared library that recreates all the "real" .so's functions but returns error codes, and (2) using dlopen() and dlsym() to recreate the functions, so that the function calls in the code do not cause the runtime loader to find a dependency on the shared library. Both ways are labor-intensive as far as I'm concerned.
What I'd really like is for the failure of runtime loading of a shareable library not to be a fatal error. Is there a way to do this?