Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't include winsock2.h in public headers #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions include/enet/win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@
#pragma warning (disable: 4244) // 64bit to 32bit int
#pragma warning (disable: 4018) // signed/unsigned mismatch
#pragma warning (disable: 4146) // unary minus operator applied to unsigned type
#pragma warning (disable: 4142) // benign redefinition of type
#endif
#endif

#include <stdlib.h>

#ifdef ENET_BUILDING_LIB
#include <winsock2.h>
#endif

// If these typedefs don't match what's in winsock2.h, compilation will fail.
#ifdef _WIN64
typedef __int64 SOCKET;
#else
typedef __int32 SOCKET;
#endif
typedef SOCKET ENetSocket;

#define ENET_SOCKET_NULL INVALID_SOCKET
Expand Down Expand Up @@ -45,7 +55,12 @@ typedef struct
#define ENET_API extern
#endif /* ENET_DLL */

#ifdef ENET_BUILDING_LIB
typedef fd_set ENetSocketSet;
#else
// This struct will never be defined; it can only be used for pointers.
typedef struct ENetSocketSet ENetSocketSet;
#endif

#define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset))
#define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset))
Expand Down