Skip to content

Statically link Visual C++ Runtime (/MT) to prevent loading errors #103

Description

@OmarAlamiTP

Following up on #75, which was closed with the workaround of installing the Visual C++ redistributable.

The root cause is that ktx_unity.dll is compiled with dynamic VC++ runtime linking (/MD), creating hard dependencies on MSVCP140.dll, VCRUNTIME140.dll, and VCRUNTIME140_1.dll. These DLLs are not shipped by Unity itself, so users without the redistributable installed will silently fail to load any KTX assets.

Unity packages are generally expected to be self-contained. This one is not, and there is currently no documentation warning of this requirement.

Two improvements would address this:

  1. Compile ktx_unity.dll with static runtime linking (/MT)
    This is probably the correct fix. It eliminates the external dependency entirely and makes the package genuinely self-contained, consistent with what package consumers expect. The trade-off is a slightly larger DLL.

  2. If static linking is not feasible, document the dependency explicitly
    The README and Unity Package Manager description should state that the Visual C++ 2015–2022 x64 redistributable is required on Windows, with a link to the Microsoft download. Application developers using this package need to know to bundle it in their own installers.

Most affected users happen to have the redistributable already (installed by Steam, Visual Studio, or other software), which is why this issue is not universal, but that is not a reliable guarantee for end users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions