From 536170c3317da2a53b2f04fffbcb60e1e68ea017 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 21 Sep 2022 20:22:14 -0700 Subject: [PATCH] Windows: Buildfixes --- include/mgba-util/socket.h | 4 +++- src/script/socket.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/mgba-util/socket.h b/include/mgba-util/socket.h index 731970d54..67f635ca1 100644 --- a/include/mgba-util/socket.h +++ b/include/mgba-util/socket.h @@ -195,9 +195,11 @@ static inline Socket SocketOpenTCP(int port, const struct Address* bindAddress) int err; - int enable = 1; + const int enable = 1; #ifdef GEKKO err = net_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)); +#elif defined(_WIN32) + err = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*) &enable, sizeof(enable)); #else err = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)); #endif diff --git a/src/script/socket.c b/src/script/socket.c index bdf66992a..a585c8563 100644 --- a/src/script/socket.c +++ b/src/script/socket.c @@ -5,6 +5,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include +#include + #include #include #include