Repository navigation
Conversation
ebraminio
force-pushed
the
crt-free
branch
11 times, most recently
from
November 20, 2026 01:38
3b6c69d to
4f86d3b
Compare
ebraminio
force-pushed
the
crt-free
branch
10 times, most recently
from
November 22, 2026 12:45
ac98609 to
f7156d3
Compare
ebraminio
commented
Nov 22, 2026
|
|
||
| #if defined(_MSC_VER) | ||
| #pragma warning(push) | ||
| #pragma warning(disable: 4815) |
Author
There was a problem hiding this comment.
This suppression is unrelated to the CRT-free backend. Upstream’s last windows-cmake-msvc run (2026-11-16) used MSVC 14.51.36231 and passed; MSVC 14.52.37025, rolled out in the windows-2025-vs2026 image afterward, began emitting C4815 for this intentional flexible-array base object under /W4 /WX. Keeping the suppression scoped here lets the compiler update through without changing the test’s allocation behavior.
Add HIDAPI_NO_CRT to replace CRT allocation, string, memory and formatting helpers with Win32 equivalents while leaving the default CRT build unchanged. Descriptor reconstruction uses the same helpers; stack probes and security cookies are disabled only for this library mode. Add MSVC, clang-cl and MinGW no-CRT CI that links a custom-entry probe without the CRT and checks its DLL imports. Assisted-by: deepseek-harness:deepseek-flash
MSVC 14.52, rolled out on the windows-2025-vs2026 image after 2026-11-20, diagnoses the intentional flexible-array base object under /W4 /WX. This is unrelated to the CRT-free backend; scope the suppression to the upstream reconstructor helper so the new compiler does not fail CI. Assisted-by: deepseek-harness:deepseek-flash
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HIDAPI's Windows backend uses the CRT for allocation, wide-string operations, and error formatting. That is fine for normal desktop builds, but it can matter when HIDAPI is linked into code that does not control the process runtime: ASI/Mod loader plugins, audio/video plugins, game overlays, and similar injected modules, or a native messaging host. Those hosts may build with
/NODEFAULTLIB, supply their own entry point, or pin a runtime, and a library that pulls in CRT imports can be awkward or impossible to fit. This is not a claim that the UCRT is usually missing or that/MTis not a valid alternative; the narrow case is a host that has already chosen a no-CRT or fixed-runtime model. Binary size can improve as a side effect, but it is not the main argument.This is a suggestion for an opt-in
HIDAPI_NO_CRTmode that uses Win32 allocation, string, and memory helpers instead. The normal CRT build remains the default and itsswprintf/wcstol/towupperpaths are untouched; the replacements are compiled only when the option is enabled. Report descriptor reconstruction is covered by the same helpers.A shared HIDAPI DLL still needs CRT startup unless its consumer supplies a custom entry point, so this only removes CRT function imports; the primary target is static embedding.
If this is accepted, a reasonable follow-up would be to make the internal helpers inline and use them in the default Windows path as well, so the two implementations can eventually collapse into one. The
mem*shims are the part that needs care: they exist for compiler-generated calls, not for HIDAPI's own code, and removing them requires either compiler/linker changes or keeping a small shim. I would not expand this PR to change the default path yet; the safer sequence is to let the opt-in path get some use and CI coverage first.If this does not fit HIDAPI's direction or the maintenance cost is not worth it, closing or ignoring it is completely fine.