开发者

Partial link in MS Visual Studio?

开发者 https://www.devze.com 2023-02-05 19:53 出处:网络
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).

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 "part开发者_高级运维ial 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?


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.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号