Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Almost all big titles that I have played require you to install the MSVC runtime. There have been numerous questions about "statically vs. dynamically linked CRT" on StackOverflow, the reasons for dynamic CRT generally boil down to:

  1. Reduced memory usage if other programs are using the same libs
  2. Can update the libraries independently.

But I wonder, how often are these reasons related to game development?

  • Most games spend at least a hundred MB of RAM and it's not like saving some KBs really matter. Besides, games are supposed to capture the user's sole attention so he'll probably not be running other programs to share the CRT.
  • I don't think I have seen a game needing to upgrade its CRT in its life-cycle.

So, why don't games statically link their CRT so they can reduce the extra step of installing MSVC runtime?

share|improve this question
    
You are always sharing the CRT. You probably have at least 20 other processes running even when you have just fired up a game straight after a reboot. –  Kylotan Oct 29 '10 at 15:24
add comment

3 Answers

If the CRT contains a critical bug, it means they don't need to recompile their huge code base as they would have to do with static linking. it also adds ease to certain debugging tools that replace crt calls(IAT hooks are easier than finding every call instance and rerouting it).

Imo, static linking of the CRT should be avoided, as lot of older games had this, but some of them now suffer due to changes in the CRT of the host not matching what the internal CRT is doing.

share|improve this answer
    
Your first part is correct. Your second is not. If you're statically linked to the CRT then there's no issue with there being other versions of the CRT in use on the same machine. All you could be exposed to are bugs in the version of the CRT that you're statically linked to. –  Len Holgate Oct 28 '10 at 14:28
    
@Len Holgate: I'd say the second part is definatly correct, imagine this: your game is spread across multiple dlls(as many are), one of those dlls is an old utility lib, statically linked to crt, its never needed an update because its function never changes. It allocates some memory(say a strdup clone) using its old crt heap structure, the newer dll(s) that requested this then proceed to free the memory...boom! The newer crt heap implementation they use isn't compatible anymore. If your lucky this is detected before release, if your not, well, lets just say the reviews won't be as good –  Necrolis Oct 28 '10 at 15:10
1  
Given your clarification then yes there is a potential issue. You really shouldn't be allocating in one dll and freeing in another IMHO, but that's another issue. –  Len Holgate Oct 28 '10 at 18:05
1  
"If the CRT contains a critical bug, it means they don't need to recompile their huge code base " I mean realistically, does this happen a lot during a game's development lifecycle? Maybe once or twice but an extra fresh rebuild every single year probably isn't too bad, no? –  kizzx2 Oct 29 '10 at 7:25
    
@kizzx2: its a good idea, by just stick do dynamic linkage and you don't need to worry about forgetting to do it(also, your static libs might be out of date, so a recompile might not help). also some game engines span years apon years(think Unreal engines), not only for their core development, but also the 3rd parties that lease them... –  Necrolis Oct 29 '10 at 8:02
add comment

The argument for dynamic linking the CRT is that you get bug fixes for free. If a bug is fixed in the CRT and the user updates his machine and gets the fix then your program is fixed where it wouldn't be if you were static linked.

The argument against is that you get bug fixes for free. You might be relying on the potentially undocumented and incorrect behaviour and the 'fix' breaks your code. Suddenly your game stops working for 'no reason'.

Personally I tend to avoid dynamic linking wherever possible.

share|improve this answer
    
"undocumented and incorrect behaviour" may vary even for different reasons so better avoid it at all cost. "undocumented and incorrect behaviour" in some corner cases may be deeper in system stack so even changing a version of Windows may affect it (from real live - some game used freed memory which cased it to crash after using on newer Windows. If game is popular it probably will have a quirk to solve it. If it is not - well you may not be so lucky). –  Maciej Piechotka Nov 1 '10 at 0:36
    
I agree, BUT with dynamic linking you don't have control over finding and fixing it. With static linking you do. –  Len Holgate Nov 1 '10 at 8:32
add comment

Doesn't it come preinstalled with windows? I am not a full-time gamer, but I don't remember a single time when I had to install/update MSVC runtime.

share|improve this answer
2  
I am frequently asked to install it again when installing new PC games. Different versions perhaps? –  Flintlock Oct 27 '10 at 18:12
1  
Maybe it's just badly written installers that don't check for existing version. –  Sergio Tulentsev Oct 27 '10 at 18:38
    
Games use different version of MSVS. For example many games still use MSVS 2005. Strangely enough games are the only apps where I am asked to install them upfront. Don't other applications have the same issue? –  kizzx2 Oct 28 '10 at 0:34
    
Anyway this should have been a comment. How your computer is configured vs mine has nothing to do with the question. –  kizzx2 Oct 28 '10 at 0:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.