Fix Windows/MinGW Compatibility and Socket Type Mismatches#28
Open
jolavillette wants to merge 1 commit intoi2p:masterfrom
Open
Fix Windows/MinGW Compatibility and Socket Type Mismatches#28jolavillette wants to merge 1 commit intoi2p:masterfrom
jolavillette wants to merge 1 commit intoi2p:masterfrom
Conversation
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.
Note to the maintainer: these changes are required to successfully compile RetroShare for Windows/MinGW
Description
This PR addresses several compilation and runtime issues encountered when building libsam3 on Windows using the MinGW toolchain.
Key Changes:
Header Inclusion Order: Swapped winsock2.h and windows.h inclusion order to prevent macro redefinition conflicts and ensure proper socket API availability.
Socket API Compatibility:
Defined ioctl as ioctlsocket on Win32 platforms.
Added explicit type casts (const char* and char*) for parameters in setsockopt and getsockopt calls, as required by the Windows Sockets API.
Type Safety: Updated sam3aBytesAvail to use u_long for the FIONREAD command on Windows, ensuring correct behavior when checking for available data on a socket.
Portability: Ensured that MSG_NOSIGNAL and SHUT_RDWR are correctly defined or handled for the Windows environment.