Reputation: 35
I'm a beginning C++ programmer and I'm trying to make a fully static program (just one .exe) in Visual Studio. It's gotten me thinking though, because there are some external dependencies that are pulled from the user's computer, like MSVCP.dll. Are those dependencies baked in to the program from the programmer's computer, or are they still left out and pulled from the user?
-Ari
Upvotes: 0
Views: 166
Reputation: 30879
The MS Visual C++ compiler gives you the option to choose what version of the MS Visual C/C++ Runtime library you want to link to. The choices are:
Doing a quick test with a simple hello world program, the compiled executable ended up being about 12KB with /MD, while it weighed in at about 219KB with /MT, so the difference in size is considerable, especially if you're shipping lots of small programs.
There also used to be single-threaded versions of the library that could, in theory provide better single-thread performance and smaller size, but those are no longer provided with newer versions of the CRT. Presumably the difference was too minor for it to make sense shipping an entire separate build of the library.
Upvotes: 1
Reputation: 27577
Are those dependencies baked in to the program from the programmer's computer, or are they still left out and pulled from the user?
As @Igor comments, you can do either. The difference being a (perhaps rather large) single independent statically-linked executable file or one that depends on local DLLs to run.
Upvotes: 1