简体   繁体   中英

Objective C: Version of JSON library I'm compiling in present in another library I'm linking in via .a, how to resolve conflict?

I'm compiling in a local version of the SBJson library into my iPad project. I just started linking in a static .a library that has compiled symbols that collide with objects in the SBJson library. I am able to modify the SBJson library, what is the best way to modify it to avoid the name collisions?

I had a similar problem with expat a few years ago. Basically, we prefixed all the publicly exported functions/classes with some string that would designate it as being ours. So if a function was called foo, it would be PREFIX_foo. Likewise for classes. Then you'd change the classes in your code to use your prefixed versions.

What you can also try is just using the headers to compile and removing your link line. That is a bit risky since you don't know what version is in that static lib or if it was modified (or do you?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM