Visual Studio Linker Settings/Linking Duration


#1

Trying to improve linker performance on Windows using Visual Studio 2015 I tried activating the /INCREMENTAL linker option. It initially didn't work because Juce by default sets the /FORCE:multiple linker option which blocks incremental linking.

After realizing deleting the /FORCE:multiple flag doesn't break my builds I started to wonder why it is set. In the Introjucer code I see it always gets added during export if it's not present (jucer_AudioPluginModule.h  prepareExporter(..) method line 394). As far as I can tell there is no way to remove it permanently without patching Introjucer, or is there?

Digging some more I found some threads about problems with RTAS builds on windows that probably lead to activating this switch. Jules once wrote in a "How to use" textfile:

- Because the RTAS code duplicates some win32 constants, you might need to force it to link correctly
by adding "/FORCE:multiple" to the linker's additional command line options.

That makes me think this constant is only needed for RTAS which I don't use. If all my assumptions are correct, could maybe the exporter be patched so it only adds this flag if RTAS is enabled in a project? And possibly /INCREMENTAL could be activated for debug builds by default

Or is there another reason this flag is needed?

 

 


#2

The flag is only added if you're building an RTAS or VST. I'm actually not sure why it's also set for a VST, I guess it could be removed from that..

Anyone else got any experience with that flag and why it might be necessary?


#3

Afaik the /incremental flag is there to speed up compilation because it helps VS to find code that it doesn't have to recompile. I think it's useful to turn that on, however, I vaguely remember that it can have some issues as well, such as messing up the pdb files with debugging information. (Not really the expert here I have to admit)

The /force:multiple flag which conflicts with that seems to be some very obscure option that is only needed for legacy stuff like RTAS and useless otherwise.

 


#4

When I look at the code it seems to me the flag is always added for any plugins builds including AAX - not just VST and RTAS.

The /INCREMENTAL linker flag enables incremental linking. That means only changed files need to be relinked (most of the time). I believe this feature is quite mature on VS2015 but in case it goes wrong, a clean build will always solve linking issues.

On my windows machine (with many cores) linking is the step that takes by far the most time when rebuilding because it currently always does a full link.

The /FORCE:multiple linker flag makes the linker not abort in case a class/function/whatever is found multiple times and is apparently needed for RTAS. 

All I'd like to have is the option to stop Introjucer from always adding /FORCE:multiple or to only add it for RTAS... or maybe even to add it so it's visible to the user. It could still stay for release builds somehow.

Currently I need to manually remove this flag from my .sln every time I reexport from Introjucer. Or is there a way to automate that? That would also be ok for me.

 

 

 

 


#5

It's only added in VST and RTAS builds, but I think we can probably remove it from the VST version - I'll make that change and we can see what happens..


#6

Thanks for looking into this. Reading the introjucer code again I agree it happens only in the rtas and vst/vst3 exporters.. sorry about that. I think if getting rid of /FORCE:.... leads to any other problems, then it might be better to try to solve these in a different way. I understand that's not worth it for RTAS, but in my opinion it's quite a bad flag to use for production code.