简体   繁体   English

iphone目标库静态库中的静态库

[英]iphone objective c static library within static library

I am trying to distribute static lib that contain static lib (google adMob). 我正在尝试分发包含静态库(google adMob)的静态库。

In my test application that uses the static library, it crashes when trying to access the static library within the static library. 在使用静态库的测试应用程序中,尝试访问静态库中的静态库时,它会崩溃。

Any ideas on how to distribute static library that contain static library? 关于如何分发包含静态库的静态库的任何想法?

10x Tamir 10x塔米尔

There is no such thing as a "static library within a static library". 没有“静态库中的静态库”之类的东西。 A static library is just a container of object files. 静态库只是对象文件的容器。 And they are all equal. 他们都是平等的。

You have two options: 您有两种选择:

  1. Distribute your own library and the third party library as two separate files. 将您自己的库和第三方库作为两个单独的文件分发。 The final project then needs to include both libraries. 然后,最终项目需要包括两个库。

  2. Merge the two libraries, ie create a library that contains all your object files and the object files of the third party library. 合并两个库,即创建一个包含所有目标文件和第三方库的目标文件的库。 Have a look at the man pages for ar , libtool , ranlib etc. for more information. 有关更多信息,请参见 arlibtoolranlib等的手册页。

Option 1 seems the easier one. 选项1似乎更容易。 If your static library has additional dependencies on dynamically linked libraries (such as an iOS framework or libiconv), then you'll have to provide instructions about how to add these dependencies anyway. 如果您的静态库对动态链接的库(例如iOS框架或libiconv)具有其他依赖关系,则您必须提供有关如何无论如何添加这些依赖关系的说明。

(I don't quite understand when and how your test app crashes. You'd have to provide more information such as the full error message and the stack trace. Normally, I'd expect that the app doesn't even build since it can't find all dependencies.) (我不太了解测试应用程序何时以及如何崩溃。您必须提供更多信息,例如完整的错误消息和堆栈跟踪。通常,我希望该应用程序甚至不会生成,因为它找不到所有依赖项。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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