-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Statically link MSVC binaries #8
Comments
I think I'll provide the static binary by default, but will give an option to download the shared one too. |
How much does this affect the size? I ran into this issue the other day when trying one of our internal bat files on a fresh VM. If it's significant in size, I think providing both would be great - as you already stated =) |
@aplocher As mentioned in the original post, it's about 12x size difference, 25 kB vs 400 kB, though packing could reduce this somewhat. Since you can't really depend on the redist existing, using the dynamically-linked binary is quite risky if you ever plan to use it outside an environment you control, and potentially annoying even when you do have control. You can actually get coloured output with PowerShell Write-Host too, and it comes default in Vista and newer. So you can call |
Sorry, duh lol, I must have skimmed (or skipped) the end of the original post. I've been doing more of my complex scripts in powershell, but I find it a fun challenge to see how ridiculously complicated I can make a bat file. CmdColor.exe has been in my toolbag for a while now as far as colorization goes, I only just recently realized it had deps on MSVCRT. I wonder what it would take to remove that dependency completely? I'm sure cmdcolor is using a very small piece of that giant DLL. I like your powershell approach, I do some hybrid powershell or sometimes VBS stuff in my bat files, so it wouldn't be adding any new dependencies that i don't already have - I'll look further into implementing that. Thanks |
Currently, building with MSVC creates a dependency on
MSVCRT.DLL
(specifically,MSVCP120.DLL
when built with VS2013). This is not necessarily available on all systems.Changing the
/MD
option to/MT
will build statically-linked binaries, which are far more portable. The cost is an increase of file size from ~25 kB to ~400 kB (unpacked).Reference:
http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
http://stackoverflow.com/a/37402
The text was updated successfully, but these errors were encountered: