在 Cocoa 应用程序中使用什么更好:动态库还是静态库?
我需要在 Cocoa 应用程序中使用库,并且可以使用它的动态 (.dynlib
) 或静态 (.a
) 版本。我来自 Linux 世界,并且很乐意使用 dynlib。但是,由于应用程序包将包含所有依赖项(包括 dynlib),我认为由于静态链接而拥有更大的二进制文件不会成为问题。最好的解决方案是什么?
I need to use a library in a Cocoa application and can use either a dynamic (.dynlib
) or a static (.a
) version of it. I came from Linux world and would happily use the dynlib. However, since the app bundle will contain all the dependencies (including the dynlib) I thought it would not be a problem to have a bigger binary due to the static linking. What is the best solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在这种情况下,我关心的是大型可执行文件与小型可执行文件和多个库的加载时间的响应能力。差异可能很小。
In this case, my concern would be responsiveness with respect to loading time of big executable vs. small executable and multiple libraries. The difference may be small.
您无法创建
动态库
.dylib
,但您可以创建内部包含.dylib
的动态框架
。答案取决于您的需求[iOS 静态库与动态库]
[创建Objective-C动态框架]
You cannot create a
dynamic library
.dylib
but you are able to create adynamic framework
with.dylib
inside. The answer depends on your needs[iOS static vs dynamic library]
[Create Objective-C dynamic framework]
iOS 应用程序不应有任何动态库。您唯一的选择是静态链接代码。
iOS app should NOT have any dynamic libraries. Your only option is to statically link code.