121

I've looked at Microsoft's MSDN and all around the web, but I still haven't been able to get a really good idea of what it is.

Does it mean the completed program loads DLLs at different times during its execution, as apposed to all at once upon launch?

Am I totally way off? :)

Russel
  • 3,609
  • 8
  • 33
  • 32
  • 2
    I added an answer for GNU ld but it was deleted, here is a similar one: https://stackoverflow.com/questions/29391965/what-is-partial-linking-in-gnu-linker/53959624#53959624 – Ciro Santilli OurBigBook.com Dec 29 '18 at 10:30
  • 1
    It was deleted because Copy, Paste and Diverge is bad - no matter how good the content is https://en.wikipedia.org/wiki/Don%27t_repeat_yourself – MarcH Dec 30 '19 at 22:03

2 Answers2

131

Linking involves packaging together all of the .obj files built from your source files, as well as any .lib files you reference, into your output (eg .exe or .dll).

Without incremental linking, this has to be done from scratch each time.

Incremental linking links your exe/dll in a way which makes it easier for the linker to update the existing exe/dll when you make a small change and re-compile.

So, incremental linking just makes it faster to compile and link your project.

The only runtime effect it might have is that it may make your exe/dll slightly bigger and slower, as decribed here:

http://msdn.microsoft.com/en-us/library/4khtbfyf.aspx

Edit: As mentioned by Logan, incremental linking is also incompatible with link time code generation - therefore losing a possible performance optimization.

You may want to use incremental linking for debug builds to speed development, but disable it for release builds to improve runtime performance.

Delay loaded DLLs may be what you are thinking of:

http://msdn.microsoft.com/en-us/library/151kt790.aspx

Saxon Druce
  • 17,406
  • 5
  • 50
  • 71
  • Ah, I thought linkers always did this anyway! So, shutting off `incremental linking` will make the linker link everything from scratch each time? – Russel Jul 28 '10 at 02:56
  • 7
    "In practise the effect of this is probably not worth worrying about." it's probably worth mentioning that while the difference between "normal" linking and incremental linking may not be that great performance wise at run-time, incremental linking is incompatible with link time code generation which can make a drastic performance difference. – Logan Capaldo Jul 28 '10 at 02:58
  • So does that mean we should turn off this option for production builds? – RBT Oct 17 '16 at 08:24
  • 1
    @RBT, yes you must. – Ajay Oct 17 '16 at 08:55
17

Also, quite importantly, incremental link is a prerequisite for Edit&Continue - possibily to edit your code and recompile it on the fly, without restarting.

So it is a good thing to have on debug builds, but not release builds.

Mack
  • 2,556
  • 1
  • 26
  • 44
Cavaler
  • 166
  • 1
  • 5