I have a linux shared library, foo.so, which is loaded from an executable using dlopen("foo.so", RTLD_NOW | RTLD_LOCAL) . From foo.so, I would like to dlopen another bar.so library that references the characters defined in foo.so, but the linker does not find them. I canโt change RTLD_LOCAL to RTLD_GLOBAL because I donโt have the source of the executable loading the file. I thought that -Wl,--export-dynamic , when the foo.so link can help, but does not undo the local flag in dlopen. The visibility function of the new GCC attribute is not like it is offering an answer.
Is there a way that I can give the linker the linker to allow references to undefined characters in bar.so for these definitions in foo.so, without binding the line with -lfoo or similarity of moving characters in the 3rd library and linking both foo and the bar against it ? The only thing that happens to me is dlopen foo.so with RTLD_GLOBAL from foo.so itself, then dlopen bar.so, but it hits me like a bit of a mess. Thanks.
linux shared-libraries dlopen
mr grumpy
source share