Fix Winsock type incompatibilities on modern MinGW-w64 (UCRT / GCC 16)#224
Open
johnnyvillanueva wants to merge 1 commit into
Open
Fix Winsock type incompatibilities on modern MinGW-w64 (UCRT / GCC 16)#224johnnyvillanueva wants to merge 1 commit into
johnnyvillanueva wants to merge 1 commit into
Conversation
Owner
|
The patch does affect non-mingw builds (at the getsockopt() change). Please isolate this to mingw. |
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.
Summary
This patch fixes compilation errors on modern Windows toolchains using MinGW-w64 (UCRT64) with recent GCC versions (e.g. GCC 16).
The issue occurs due to stricter type checking in Winsock APIs where
getsockopt()andsetsockopt()expectchar */const char *parameters, but the code passesDWORD *orint *types without explicit casting.Problem
On modern MinGW-w64 / UCRT environments, the following compilation errors occur:
getsockoptsetsockoptThese were previously accepted as implicit conversions in older GCC versions but are now treated as errors under stricter type checking.
Fix
This patch adds explicit casts to match the Winsock API expectations:
DWORD *→(char *)int *→(const char *)No functional changes are introduced.
Impact
Fixes build failures on:
No impact on Linux builds
No behavioral change in runtime logic
Tested on
Notes
This issue appears due to stricter type enforcement in newer GCC versions combined with Winsock API signatures on Windows.
The fix is minimal and scoped to Windows builds.