Skip to content

Windows: tests fail with exit code 0xc0000135 (DLL not found at runtime) #3292

@captainkirk99

Description

@captainkirk99

Fix: Windows tests fail with exit code 0xc0000135 (DLL not found)

Summary

Many tests fail on Windows with exit code 0xc0000135, which means the
process could not start because a required DLL was not found on PATH.
The affected tests span multiple test suites:

  • nc_test4 (e.g. tst_xplatform, tst_virtual_datasets)
  • examples/C (e.g. simple_xy_wr, pres_temp_4D_wr)
  • unit_test (e.g. test_ncuri)
  • nczarr_test (e.g. test_unlim_vars, test_put_vars_two_unlim_dim)

Root Cause

The CI ctest invocation only prepended ~/tmp/bin to PATH:

PATH=~/tmp/bin:$PATH ctest . -j 4 -E 'bom' --output-on-failure

~/tmp/bin is the install prefix for netcdf.dll. However, two
additional directories are required:

  1. ${CONDA_PREFIX}/Library/bin — contains HDF5 DLLs
    (hdf5.dll, hdf5_hl.dll, etc.) installed by conda. Without
    these, any executable that links against HDF5 fails immediately
    with 0xc0000135.

  2. build/liblib/Release — the MSVC multi-config build layout
    places netcdf.dll here. If the install step did not copy it to
    ~/tmp/bin (or if ~/tmp/bin is not on the Windows DLL search
    path for some reason), this fallback ensures the DLL is found.

Fix

Add both directories to PATH for the ctest invocation and the
verbose re-run step:

PATH=~/tmp/bin:${CONDA_PREFIX}/Library/bin:$(pwd)/liblib/Release:$PATH \
  ctest . -j 4 -E 'bom' --output-on-failure

Files changed

  • .github/workflows/main-cmake.yml — updated PATH in both the
    "Run ctest" and "Verbose Output if CTest Failure" steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions