build(runtime): compile and link the libraries with MSVC #8

Manually merged
github merged 1 commit from gh-pr/8/head into gh-pr/8/base 2026-11-26 19:13:36 +00:00
Owner

@⁠CaseReed on GitHub · 2026-11-21 05:23 UTC · original
CaseReed:fix/msvc-build → main · +8 −8 · 5 files · 1 commits · merged 2026-11-21 06:59 UTC

What

The full build fails with MSVC, which docs/dev/BUILD.md lists as supported; CI only builds the libraries with MinGW. This makes it compile and link, with no behaviour change:

  • C3829 in AbxApi.hpp and Runtime.cpp: MSVC rejects [[noreturn]] after extern "C" __declspec(...). The attribute moves after the function name, a standard position GCC accepts too.
  • C2589 in Runtime.cpp: std::min collides with the min macro from <windows.h>. The call is parenthesised. It is the only std::min/std::max seen by <windows.h>, so no NOMINMAX in CMake.
  • LNK2001 for ab_gameinput.dll and ab_xaudio2.dll: link.exe resolves a forwarder's target at link time, so the two forward-only libraries need the Windows SDK import libraries (gameinput.lib, xaudio2.lib). They are linked for MSVC only, through the existing LINK argument. ab_kernelx.dll already linked because kernel32.lib is a default library.
  • BUILD.md states the Windows SDK requirement.

The LINK value is a generator expression rather than an if(MSVC) block with two calls, because tools/stubgen.py edits the first anybox_add_xdll( it finds and would add Inventory.cpp to one branch only. Happy to switch if you prefer the block.

Tested

Windows 11, CMake 4.4.4, Ninja 1.13.2, Windows SDK 10.0.26100, clean build directories.

Compiler Build ctest
MSVC 19.38 (VS 2022) full build ok 22/22
MSVC 19.51 (VS 2026) full build ok 22/22
MSVC 19.38 relinker only ok 19/19
  • dumpbin /exports: ab_gameinput.dll forwards 1 export to gameinput, ab_xaudio2.dll 6 to xaudio2_9, ab_kernelx.dll 39 to kernel32.
  • dumpbin /dependents: ab_gameinput.dll and ab_xaudio2.dll have the same load-time dependencies as the libraries without LINK; neither gameinput.dll nor xaudio2_9.dll is added.
  • python tools/check_conventions.py: ok.

Not tested locally: the MinGW full build (no GCC on this machine), so this relies on CI. A minimal snippet with the new [[noreturn]] placement and (std::min) compiles without warnings under -std=c++20 -Wall -Wextra -Werror with MinGW GCC 13.1, 15.2 and 16.2 on Compiler Explorer. Only SDK 10.0.26100 was checked; I don't know the oldest SDK that ships gameinput.lib.

Observed, not changed: under MSVC e2e_crash passes but skips the crash report check (no report written), the gap already recorded in docs/dev/debt/runtime.md for the GitHub runner (#7).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • python tools/check_conventions.py passes (no comments in code, one declaration per export, Conventional Commit subjects)
  • Unimplemented paths stop (AbxNotImplemented / AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragment (no function body changed)
  • Known gaps added, changed or removed through docs/dev/debt/changes/<branch>.md (none added)
  • Generic behaviour, not specific to one title
  • No game files, keys, notes or logs added to the repository
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • Source of behaviour: n/a (build only)
  • AI-assisted: yes

🤖 Generated with Claude Code

**@⁠CaseReed** on GitHub · 2026-11-21 05:23 UTC · [original](https://github.com/Dark3581/AnyBox/pull/8) `CaseReed:fix/msvc-build` → `main` · +8 −8 · 5 files · 1 commits · merged 2026-11-21 06:59 UTC ### What The full build fails with MSVC, which `docs/dev/BUILD.md` lists as supported; CI only builds the libraries with MinGW. This makes it compile and link, with no behaviour change: - **C3829** in `AbxApi.hpp` and `Runtime.cpp`: MSVC rejects `[[noreturn]]` after `extern "C" __declspec(...)`. The attribute moves after the function name, a standard position GCC accepts too. - **C2589** in `Runtime.cpp`: `std::min` collides with the `min` macro from `<windows.h>`. The call is parenthesised. It is the only `std::min`/`std::max` seen by `<windows.h>`, so no `NOMINMAX` in CMake. - **LNK2001** for `ab_gameinput.dll` and `ab_xaudio2.dll`: `link.exe` resolves a forwarder's target at link time, so the two forward-only libraries need the Windows SDK import libraries (`gameinput.lib`, `xaudio2.lib`). They are linked for MSVC only, through the existing `LINK` argument. `ab_kernelx.dll` already linked because `kernel32.lib` is a default library. - `BUILD.md` states the Windows SDK requirement. The `LINK` value is a generator expression rather than an `if(MSVC)` block with two calls, because `tools/stubgen.py` edits the first `anybox_add_xdll(` it finds and would add `Inventory.cpp` to one branch only. Happy to switch if you prefer the block. ### Tested Windows 11, CMake 4.4.4, Ninja 1.13.2, Windows SDK 10.0.26100, clean build directories. | Compiler | Build | ctest | |---|---|---| | MSVC 19.38 (VS 2022) full build | ok | 22/22 | | MSVC 19.51 (VS 2026) full build | ok | 22/22 | | MSVC 19.38 relinker only | ok | 19/19 | - `dumpbin /exports`: `ab_gameinput.dll` forwards 1 export to `gameinput`, `ab_xaudio2.dll` 6 to `xaudio2_9`, `ab_kernelx.dll` 39 to `kernel32`. - `dumpbin /dependents`: `ab_gameinput.dll` and `ab_xaudio2.dll` have the same load-time dependencies as the libraries without `LINK`; neither `gameinput.dll` nor `xaudio2_9.dll` is added. - `python tools/check_conventions.py`: ok. Not tested locally: the MinGW full build (no GCC on this machine), so this relies on CI. A minimal snippet with the new `[[noreturn]]` placement and `(std::min)` compiles without warnings under `-std=c++20 -Wall -Wextra -Werror` with MinGW GCC 13.1, 15.2 and 16.2 on Compiler Explorer. Only SDK 10.0.26100 was checked; I don't know the oldest SDK that ships `gameinput.lib`. Observed, not changed: under MSVC `e2e_crash` passes but skips the crash report check (`no report written`), the gap already recorded in `docs/dev/debt/runtime.md` for the GitHub runner (#7). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] `python tools/check_conventions.py` passes (no comments in code, one declaration per export, Conventional Commit subjects) - [x] Unimplemented paths stop (`AbxNotImplemented` / `AbxUnsupported`); silent stubs are listed under Silent stubs through a debt fragment (no function body changed) - [x] Known gaps added, changed or removed through `docs/dev/debt/changes/<branch>.md` (none added) - [x] Generic behaviour, not specific to one title - [x] No game files, keys, notes or logs added to the repository - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] Source of behaviour: n/a (build only) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The full build failed with MSVC 19.38, 19.44 and 19.51:

- C3829: [[noreturn]] after extern "C" __declspec(...) is rejected.
  Move the attribute after the function name, a standard position
  that GCC accepts too.
- C2589: std::min collides with the min macro from windows.h in
  Runtime.cpp. Parenthesise the call.
- LNK2001: link.exe resolves a forwarder's target at link time, so
  ab_gameinput and ab_xaudio2 need the Windows SDK import libraries.
  Link them for MSVC only; the MinGW link line is unchanged.

BUILD.md states the Windows SDK requirement.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:13:33 +00:00
github manually merged commit 498e912bc7 into gh-pr/8/base 2026-11-26 19:13:36 +00:00
Author
Owner

@⁠Dark3581 on GitHub · 2026-11-21 06:59 UTC · original · approved these changes

Reviewed — looks good

Nothing blocks this change. MSVC now builds the libraries, and the MinGW build is unchanged.

What I ran

Reviewed head 498e912. Built it on its own with MinGW (WinLibs GCC 15.2 UCRT, Ninja, Release) on Windows 10, from a clean build directory.

Results

Check Result Note
MinGW full build passed no warnings
CTest passed 22/22
tools/check_conventions.py passed
tools/debt_fold.py --check passed
CI (Windows, relinker on Linux and macOS, conventions) passed
MSVC build not run author-reported, VS 2022 and VS 2026

Findings

Blocking

None.

Non-blocking

  • CI only builds with MinGW, so nothing will catch a future MSVC break. An MSVC job in build.yml would fix that; it doesn't belong in this PR.

Not verified

The MSVC build and the claim about the oldest Windows SDK that ships gameinput.lib.

To get this to a good state

Nothing is required. Thanks for the clear write-up of each error.

**@⁠Dark3581** on GitHub · 2026-11-21 06:59 UTC · [original](https://github.com/Dark3581/AnyBox/pull/8#pullrequestreview-6003672318) · **approved these changes** # Reviewed — looks good Nothing blocks this change. MSVC now builds the libraries, and the MinGW build is unchanged. ## What I ran Reviewed head `498e912`. Built it on its own with MinGW (WinLibs GCC 15.2 UCRT, Ninja, Release) on Windows 10, from a clean build directory. ## Results | Check | Result | Note | |---|---|---| | MinGW full build | passed | no warnings | | CTest | passed | 22/22 | | `tools/check_conventions.py` | passed | | | `tools/debt_fold.py --check` | passed | | | CI (Windows, relinker on Linux and macOS, conventions) | passed | | | MSVC build | not run | author-reported, VS 2022 and VS 2026 | ## Findings ### Blocking None. ### Non-blocking - CI only builds with MinGW, so nothing will catch a future MSVC break. An MSVC job in `build.yml` would fix that; it doesn't belong in this PR. ## Not verified The MSVC build and the claim about the oldest Windows SDK that ships `gameinput.lib`. ## To get this to a good state Nothing is required. Thanks for the clear write-up of each error.
This discussion has been locked. Commenting is limited to contributors.
No description provided.