Skip to content

Indicate which version of MSVC Rust was built with #26258

Open
@retep998

Description

@retep998

When linking to the CRT on Windows, all code that is statically linked together needs to use the same version of the CRT. Different versions of the CRT (aka they have different DLL names) are not ABI compatible, so msvcrt120.dll and msvcrt110.dll are not ABI compatible. In particular, almost all Rust code links statically to libstd, so the version of the CRT that libstd uses needs to be same version of the CRT that Rust code using that libstd is using.

For the gnu version of Rust, it relies on msvcrt.dll and since all versions of MinGW will link to msvcrt.dll everything is fine and dandy.

However, for the MSVC version of Rust, it is linked against a specific versioned CRT such as msvcrt120.dll. Since the version of the CRT depends on which version of MSVC you build your code with, there is a possibility for you to use a different version of the CRT than libstd was built with, causing room for potential ABI issues. There's even separate debug/release versions of the CRT for each version, as well as static/dynamically linked versions of the CRT.

Therefore, to ensure that there is no ABI compatibility issues, distributions of the MSVC version of Rust should indicate exactly which version of MSVC and the CRT they were built with.

Note that this is purely an issue for developers using Rust to build their code with the msvc toolchain. End-users of binaries built by Rust merely need to have the appropriate redistributable installed and there's no ABI concerns there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.O-windows-msvcToolchain: MSVC, Operating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions