Skip to content

Commit

Permalink
fix: Improve compatiblity with socket (#1229)
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis authored Sep 1, 2024
2 parents 5b0b339 + ec9f59f commit 7cdc15a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
10 changes: 4 additions & 6 deletions include/dpp/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@ extern bool DPP_EXPORT validate_configuration();

}

#ifndef _WIN32
#define SOCKET int
#else
#ifndef NOMINMAX
#define NOMINMAX
#endif
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif

#include <WinSock2.h>
#endif
Expand Down
12 changes: 5 additions & 7 deletions include/dpp/socket.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#pragma once

#ifndef _WIN32
#ifndef SOCKET
#define SOCKET int
#endif
#endif

namespace dpp
{
/**
* @brief Represents a socket file descriptor.
* This is used to ensure parity between windows and unix-like systems.
*/
typedef SOCKET socket;
#ifndef _WIN32
using socket = int;
#else
using socket = SOCKET;
#endif
} // namespace dpp

#ifndef SOCKET_ERROR
Expand Down

0 comments on commit 7cdc15a

Please sign in to comment.