I've a linux application that links against a static library (.a) and that library uses the dlopen function to load dynamic libraries (.so)
If I compile the static library as dynamic and link it to the application, the dlopen it will work as expected, but if I use it as described above it won't.
Can't a static library uses the dlopen function to load shared libraries?
Thanks.
There should be no problem with what you're trying to do:
app.c:
staticlib.h:
staticlib.c:
dynlib.c:
and build:
First line builds the lib
second line packs it into a static lib
third builds the test app, linking in the newly created static, plus the linux dynamic linking library(libdl)
fourth line builds the soon-to-be-dynamically-loaded shared lib.
output: