库代码内存占用分析

发布于 2024-09-06 05:56:53 字数 135 浏览 2 评论 0原文

假设我们有一个库编译成 .a 文件。之后,该库与其他代码链接到某个可执行文件 .exe 中。 .a 文件的大小为 6Mb,而 .exe 文件的大小为 3Mb。对此的明显解释是链接器已从库中抛出未使用的代码。 我想知道的是最终可执行文件中真正的库的代码足迹。

Let's say we have a some library compiled into .a file. After that this library is linked with other code into some executable file .exe. Size of .a file is 6Mb while this size of .exe file is 3Mb. Obvious explanation of this is that linker has thrower out unused code from the library.
What I want to know is the real library's code footprint in final executable file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

素衣风尘叹 2024-09-13 05:56:53

查看链接器选项。链接器通常有一个选项来生成映射文件。这是链接到最终图像的函数列表以及它们的来源。听起来你正在使用 gcc,请使用 -map 选项。

Check out the linker options. Linkers usually have an option to generate a map file. Which is a list of functions linked into the final image and where they came from. Sounds like you are using gcc, use the -map option.

老子叫无熙 2024-09-13 05:56:53

库有很多功能的实现。一个exe使用其中的一些。喜欢在exe中只添加exe使用的函数的代码。

A library has implementation of a lot of functions. An exe use some of there. The liker add in exe only the code of functions which exe use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文