Skip to content

Add WDK memcmp compatibility for legacy 32-bit Windows STL vector resize - #101

Merged
SergiusTheBest merged 3 commits into
mainfrom
copilot/kf-50-fix-resize-method
Aug 14, 2026
Merged

SergiusTheBest merged 3 commits into
mainfrom
copilot/kf-50-fix-resize-method

Conversation

Copilot AI commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

The STL implementation used by kf::vector::resize(count, value) on older 32-bit Windows targets expects a memcmp symbol that the legacy CRT does not export. This manifests when resizing integer vectors and causes the binary to pull in unsupported legacy memcmp references on Windows XP–7.

  • Overview

    • kf::vector wraps STL vector behavior and relies on the standard scalar-fill implementation behind resize(..., value).
    • On legacy 32-bit Windows, that implementation hits a compatibility issue with the old CRT, which is why the build needs the WDK-provided symbol.
  • Changes

    • Added the WDK compatibility library to the affected test target in test/CMakeLists.txt.
    • Scoped the linkage to 32-bit targets only via CMAKE_SIZEOF_VOID_P EQUAL 4, so modern 64-bit builds remain unchanged.
    • Included a brief compatibility note documenting the Windows XP/7 requirement and why the linkage is necessary.
kf::vector<int, PagedPool> test;
test.resize(10, 1);
  • Why this matters
    • This preserves the standard STL scalar-fill path for legacy 32-bit Windows without altering functional behavior on supported platforms.

Co-authored-by: SergiusTheBest <4660722+SergiusTheBest@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix resize method for kf::vector on 32-bit systems Add WDK memcmp compatibility for legacy 32-bit Windows STL vector resize Aug 14, 2026
Copilot AI requested a review from SergiusTheBest August 14, 2026 09:32
@SergiusTheBest

Copy link
Copy Markdown
Member

@copilot Build failed

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Build failed

The failure is the legacy 32-bit Windows STL compatibility issue: older Win XP/7 CRTs do not export the memcmp symbol used by scalar-fill paths in STL. The fix is to link WDK::MEMCMP for 32-bit targets, which matches the upstream WDK module behavior (FindWdk.cmake does this automatically).

Comment thread test/CMakeLists.txt Outdated
Comment thread test/CMakeLists.txt Outdated
Co-authored-by: SergiusTheBest <4660722+SergiusTheBest@users.noreply.github.com>
@SergiusTheBest
SergiusTheBest marked this pull request as ready for review August 14, 2026 09:44
@SergiusTheBest
SergiusTheBest merged commit 30c8968 into main Aug 14, 2026
4 checks passed
@SergiusTheBest
SergiusTheBest deleted the copilot/kf-50-fix-resize-method branch August 14, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants