如何隔离第三方的C/C ++/ObjC库的符号? [英] How can I isolate third-parties' C/C++/ObjC libraries' symbols from each other?
问题描述
我有一个项目,需要合并两个第三方库libA和libB.我对第三方库的影响很小(如果有的话).问题在于libA和libB都包含通用库ASIHTTPRequest的不同版本.结果,我收到如下错误:
I have a project that needs to incorporate two third-party libraries, libA and libB. I have little, if any, influence over the third-party libraries. The problem being is that both libA and libB include different versions of a common library, ASIHTTPRequest. As a result, I'm getting errors like:
-[ASIFormDataRequest setNumberOfTimesToRetryOnTimeout:]: unrecognized selector sent to instance 0x3b4170
,我只能假定是因为libA指的是libB的ASIHTTPRequest实现(或者相反).
, which I can only assume are because libA is referring to libB's implementation of ASIHTTPRequest (or the other way around).
我曾尝试使用strip -s <symbol file> -u <library>
来将库的符号相互隔离,但这导致XCode的链接器吐出数千条警告,实际上并没有解决上述的主要问题.
I've tried playing around with strip -s <symbol file> -u <library>
to isolate the libraries' symbols from each other, but that results in XCode's linker spitting out thousands of warnings and doesn't actually fix the main problem outlined above.
ld: warning: can't add line info to anonymous symbol anon-func-0x0 from ...
通常,一个人如何/应该如何将库彼此隔离?
In general, how can/should one isolate libraries from each other?
推荐答案
绝对没有办法.一个Objective-C应用程序一次只能具有一个符号的一种含义.如果您加载一个库的两个不同版本,则最后一个库将覆盖第一个库.
There is absolutely no way to do so. One Objective-C application can have only one meaning for one symbol at a time. If you load two different versions of one library the last one will overwrite the first one.
两种解决方法:
- 说服开发人员使用最新版本
- 在单独的进程中运行两个库
这篇关于如何隔离第三方的C/C ++/ObjC库的符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!