#windows #msvc #vcruntime

no-std static_vcruntime

Statically link the VCRuntime when using the MSVC toolchain

9 stable releases

1.5.1 Apr 23, 2021
1.4.1 Apr 19, 2021
1.1.0 Mar 30, 2021

#70 in Build Utils

Download history 6/week @ 2021-10-04 22/week @ 2021-10-11 38/week @ 2021-10-18 20/week @ 2021-10-25 66/week @ 2021-11-01 36/week @ 2021-11-08 43/week @ 2021-11-15 26/week @ 2021-11-22 119/week @ 2021-11-29 21/week @ 2021-12-06 31/week @ 2021-12-13 11/week @ 2021-12-20 53/week @ 2021-12-27 35/week @ 2022-01-03 43/week @ 2022-01-10 33/week @ 2022-01-17

166 downloads per month

MIT OR Apache-2.0 OR Zlib

7KB

Statically link the VCRuntime when using the MSVC toolchain.

By default, Rust requires programs to deploy vcruntime140.dll (or equivalent) when redistributing binaries. This crate statically links the library instead.

Usage

Add this to your Cargo.toml:

[dependencies]
static_vcruntime = "1.5"

And put the follwing in your main.rs:

extern crate static_vcruntime;

Then when you build a release binary, the runtime will be statically linked:

cargo build --release

Issues

If this doesn't work for you then you may need to clean the build directory before rebuilding:

cargo clean

If you are still having problems then, in the same directory as your Cargo.toml, create a folder called .cargo. In that folder create the file config.toml and add the following:

[target.'cfg(all(windows, target_env = "msvc"))']
rustflags = ["-C", "target-feature=+crt-static"]

lib.rs:

Statically link the VCRuntime when using the MSVC toolchain

By default, Rust requires programs to deploy vcruntime140.dll (or equivalent) when redistributing binaries. This crate statically links the library instead.

Usage

Add this to your Cargo.toml:

[dependencies]
static_vcruntime = "1.5"

And put the follwing in your main.rs:

extern crate static_vcruntime;

That is all. Then when you build a release binary, the runtime will be statically linked:

cargo build --release

Issues

If this doesn't work for you then you may need to clean the build directory before rebuilding:

cargo clean

If you are having problems then, in the same directory as your Cargo.toml, create a folder called .cargo. In that folder create the file config.toml and add the following:

[target.'cfg(all(windows, target_env = "msvc"))']
rustflags = ["-C", "target-feature=+crt-static"]

This makes it easier to override the defaults.

No runtime deps