链接器中不必要的链接库 [英] Unnecessary linked libraries in linker

查看:148
本文介绍了链接器中不必要的链接库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我可以从链接器和仍然生成的库排除一些库?

I have a project which I can exclude some of libraries from linker and still builds ?

它是任何更好的排除他们的性能和内存最终产品?

Is it any better to exclude them in terms of the performance and memory of final product ?

推荐答案

从最终可执行文件中排除一些未使用的库可能会使启动速度更快, / em>内存量 - 机会只有标头和库启动代码实际上会被加载,这些可以在启动后调出。

Excluding some unused libraries from the final executable might make startup a bit faster and save a tiny amount of memory - chances are only the header and library startup code will actually end up being loaded, and these can be paged out after startup.

但是,don不要手动。如果你被告知要添加库,可能有一个原因 - 也许一些函数调用你没有使用需要它,后来如果你使用该函数调用,你可能已经忘记了。

However, don't do it manually. If you were told to add the library there's probably a reason for it - perhaps some function call you're not using yet requires it, and later on if you use that function call you may have forgotten about it.

大多数链接器都有自动排除未使用的库的选项,因此您可能只需启用该选项即可为您处理。

Most linkers have an option to exclude unused libraries automatically, so you may want to just enable that option to have it take care of things for you.

注意:在一些罕见的情况下,库的启动代码可能有一些重要的影响,在这种情况下你不应该排除它。这是最好的确定通过检查图书馆的文档;这样的东西应该(希望!)清楚地记录。

Note: In some rare cases, the library's startup code might have some important effect, in which case you should not exclude it. This is something that is best determined by checking the library's documentation; things like this should (hopefully!) be clearly documented.

这篇关于链接器中不必要的链接库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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