I have 2 application lets say A1 ,A2 shared one shared object(lets say lib1) which loaded in application at runtime. A1 load lib1 using dlopen successfully. Now A2 wants to load library. Can A2?(as lib1 loaded in A1 address space). What if A1 load using RTLD_LOCAL. Can A2 load lib?
Yes, of course. From the Wikipedia article on libraries:
A shared library or shared object is a file that is intended to be shared by executable files and further shared objects files
In other words, the whole reason they're called "shared" is because more than one executable is using them.
From the docs for
Symbols defined in this library are not made available to resolve references in subsequently loaded libraries.
RTLD_LOCAL flag to
dlopen() simply indicates that when
lib1, if it defines, say, a function
f1(), and then
lib2, it can't use the
lib1, because that was loaded local.