Shared object symbol resolution
Suppose I have 2 static Libs S1
and S2
which are different versions of the same lib and have the same C (not C++) interface though implementations are different. 2 shared libs D1
and D2
each of which links to S1
or S2
only. Suppose an application A
links with S2
which is the more recent of the static libs and dynamically loads both D1
and D2
with dlopen
. Will D1
just use S1
s func开发者_开发技巧tions or is there any way to enforce it to use S2
s functions? Can anything go wrong in this setup?
EDIT: Is making a shared object S
a good way to circumvent this problem as D1
and D2
can both link to S
then?
Will
D1
just useS1
s functions or is there any way to enforce it to useS2
s functions?
Yes, D1
will use S1
functions.
No, you cannot enforce it to use S2
functions.
Can anything go wrong in this setup?
It depends on what is inside your libraries.
精彩评论