MS Visual Studio 中的部分链接?

发布于 2024-10-12 16:53:56 字数 374 浏览 8 评论 0原文

我试图在 MS Visual Studio 2005 中构建大型 C++ 应用程序时减少链接时间。我的链接时间目前为 7 到 100 秒,通常接近 7(但这似乎取决于运气)。

我的应用程序由大约 20 个静态库组成,其中一个很大,很少更改,并且依赖于一个大型第三方库,而我的任何其他库都没有使用该库。我认为这是一个典型的案例,其中部分链接将缩短构建时间。我所说的“部分链接”是指 ld -r 在 Linux 上所做的任何事情。

MS Visual Studio 是否可以实现“部分链接”?我在他们的文档中没有找到它,但也许他们称它为不同的名称,或者它可能是一个隐藏的功能。

我对部分链接的猜测有意义吗?它真的有机会帮助我吗?

I am trying to reduce link time when building a large C++ application in MS Visual Studio 2005. My link time is currently 7 to 100 seconds, usually closer to 7 (but it seems to depend on luck).

My application consists of about 20 static libraries, one of which is large, rarely changes and depends on a large third-party library, which is not used by any of my other libs. I think it is a classic case where partial link will improve build times. By "partial link" i mean whatever ld -r does on Linux.

Is "partial link" possible with MS Visual Studio? I didn't find it in their documentation, but maybe they call it a different name, or maybe it's a hidden feature.

Does my speculation on partial link make sense? Is there really a chance it will help me?

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

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

发布评论

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

评论(2

一个人练习一个人 2024-10-19 16:53:56

通过 /INCRMENTAL 开关增量链接 您正在寻找什么?

您可以做的另一件事是进行额外的间接处理:将静态库包装到 DLL 中,并通过 DLL 公开应用程序使用的任何内容。这样,该 DLL 的构建频率就可以相当低,并且与其链接的成本可能要低得多。

Is linking incrementally via the /INCREMENTAL switch what you are looking for?

One other thing you can do is to go through an extra level of indirection: Wrap the static libs into a DLL and expose whatever is used by the application via the DLL. That DLL could then be built fairly infrequently and linking with it may be far less expensive.

病女 2024-10-19 16:53:56

这可能看起来微不足道,但我的案例的解决方案是使用模块定义文件(foo.def)。
Microsoft 的文件格式规范暗示它应该仅用于 DLL 文件,但它也非常适合静态库 所以我必须将我的库更改为 DLL

这将我的最小链接时间从 7 秒减少到 2 秒(可能也有助于平均链接时间)。

This may seem trivial, but the solution in my case was using a module definition file (foo.def).
The file format specification by Microsoft implies that it should be used only for DLL files, but it works perfectly well for static libraries too so i had to change my library into a DLL.

This reduced my minimal link time from 7 to 2 seconds (probably helped the average link time too).

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