开发者

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 S1s func开发者_开发技巧tions or is there any way to enforce it to use S2s 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 use S1s functions or is there any way to enforce it to use S2s 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜