注意事项包括库作为二进制VS源 [英] Considerations for including library as binary vs source

查看:113
本文介绍了注意事项包括库作为二进制VS源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写一个SSH客户端的iPhone,我想用libssh2开源库这样做。它是用C语言编写。

I'm trying to write an SSH client for the iPhone, and I'd like to use the libssh2 open source library to do so. It's written in C.

我应该如何对包括我的iPhone应用程序这个C库?我应该把它编译成二进制一些,我包括进我的应用程序,还是我添加所有源到我的项目,并尝试编译它与我的应用程序的其他部分一起?

How should I include this C library for my iPhone app? Should I compile it into some binary that I include into the my app, or do I add all the source to my project and try to compile it along with the rest of my app?

推荐答案

我间pretting这个问题为:

I'm interpretting this question as:

我应该编译C库code一次,包括二进制库在我的项目?或者我应该包括所有的源代码和每一个我建立我的应用程序时编译它?

这要看情况。我的一个工作一个项目依赖于几个外部库。基本上,我们有一个简单的规则:

It depends. One of the projects I work one depends on several external libraries. Basically, we have a simple rule:


  • 你觉得你需要更改code C库往往?

  • Do you think you will need to change code in the C library often?


  • 如果您将被改变code,或者经常更新版本,包括源代码和项目的其余部分建造它。

  • 如果你不打算经常或根本改变code,它可能是有意义的只是在项目中包含的pre的二进制。

根据库的​​大小,您可能需要将其设置为不同的目标在你的项目,或更大的灵活性,为您的主项目的一个子项目。

Depending on the size of the library, you may want to set it up as a distinct target in your project, or for even more flexibility, as a sub-project of your main project.

如果我在你的地方,我会提前建立libssh2,只是包括我的iPhone项目的二进制库。我仍然会保持libssh2源左右,当然,在情况下,它确实需要重新修建的道路。

If I was in your place, I would build libssh2 ahead of time and just include the binary library in my iPhone project. I would still keep the libssh2 source around, of course, in case it does need to be re-built down the road.

这篇关于注意事项包括库作为二进制VS源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆