I have an executable that is linked to two shared libraries, each of which have dependencies to system shared libraries. (In this case these are the OpenCL and CUDA runtime libraries, but this does not affect the problem)
+--> libA.so ---> libOpenCL.so (on system)
Exe -|
+--> libB.so ---> libcudart.so (on system)
Exe
, along with libA.so
and libB.so
are distributed to a user. The user may not have libOpenCL.so
and/or libcudart.so
installed on their system.
The goal is that Exe
should be able to launch anyways, and detect at runtime that e.g. libA.so
could not be loaded because its dependencies are not met.
One possibility would be to make it so that libA.so
get loaded at runtime using dlopen()
, where it detects if loading failed.
Is it also possible to normally link libA.so
to Exe
, but in a way that Exe
can still launch if libA.so
could not be loaded? Is this possible on Linux and/or Windows platforms?
libA
andlibB
libraries yourself or they are external? – RepetitiouslibA
andlibB
are build along withExe
, with the same compiler/ABI. They could also be static, or even part ofExe
. They are libraries mainly as a way to group their dependencies (e.g.libB
needs multiple CUDA libraries) – Amphibious