From 0fe5f2b90a94f79999bd03808cbf7ad9ef4a9ba7 Mon Sep 17 00:00:00 2001 From: Tracer <43095317+TracerDS@users.noreply.github.com> Date: Sun, 25 Aug 2024 13:13:36 +0200 Subject: [PATCH 1/2] Improve compatiblity --- include/dpp/export.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/dpp/export.h b/include/dpp/export.h index e293aafccc..5ece08ef36 100644 --- a/include/dpp/export.h +++ b/include/dpp/export.h @@ -46,6 +46,7 @@ #else /* Including the library */ #ifdef _WIN32 + #include #define DPP_EXPORT __declspec(dllimport) #else #define DPP_EXPORT @@ -116,11 +117,13 @@ extern bool DPP_EXPORT validate_configuration(); } #ifndef _WIN32 - #define SOCKET int + #ifndef SOCKET + #define SOCKET int + #endif #else - #ifndef NOMINMAX - #define NOMINMAX - #endif + #ifndef NOMINMAX + #define NOMINMAX + #endif #include #endif From e7a895c82a385a0edcbb3cc876de69360adae10d Mon Sep 17 00:00:00 2001 From: Tracer <43095317+TracerDS@users.noreply.github.com> Date: Mon, 26 Aug 2024 17:50:31 +0200 Subject: [PATCH 2/2] Updated socket --- include/dpp/export.h | 7 +------ include/dpp/socket.h | 12 +++++------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/include/dpp/export.h b/include/dpp/export.h index 5ece08ef36..7895e79ec4 100644 --- a/include/dpp/export.h +++ b/include/dpp/export.h @@ -46,7 +46,6 @@ #else /* Including the library */ #ifdef _WIN32 - #include #define DPP_EXPORT __declspec(dllimport) #else #define DPP_EXPORT @@ -116,11 +115,7 @@ extern bool DPP_EXPORT validate_configuration(); } -#ifndef _WIN32 - #ifndef SOCKET - #define SOCKET int - #endif -#else +#ifdef _WIN32 #ifndef NOMINMAX #define NOMINMAX #endif diff --git a/include/dpp/socket.h b/include/dpp/socket.h index 04d1080035..d94914b35a 100644 --- a/include/dpp/socket.h +++ b/include/dpp/socket.h @@ -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