summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2023-12-15 12:24:04 +0100
committerGitHub <noreply@github.com>2023-12-15 12:24:04 +0100
commite2b450de2421c62dbafe567345ac47fa3c606798 (patch)
treee3a265e9ed936a3bcea68d11ffd139dd90e10db2
parent1c73db8eb4c9c12b740de7c580b451f6561abc42 (diff)
downloadluasystem-e2b450de2421c62dbafe567345ac47fa3c606798.zip
fix(mingw): fix the windows build with MinGW (#10)
-rw-r--r--src/compat.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/compat.h b/src/compat.h
index 5aca6df..35f9ef2 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -8,8 +8,13 @@
void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup);
#endif
-// Windows doesn't have ssize_t, so we define it here
-#ifdef _WIN32
+
+#ifdef __MINGW32__
+#include <sys/types.h>
+#endif
+
+#ifdef _MSC_VER
+// MSVC Windows doesn't have ssize_t, so we define it here
#if SIZE_MAX == UINT_MAX
typedef int ssize_t; /* common 32 bit case */
#define SSIZE_MIN INT_MIN
@@ -33,6 +38,7 @@ typedef intmax_t ssize_t; /* last resort, chux suggestion */
#else
#error platform has exotic SIZE_MAX
#endif
-#endif
-#endif
+#endif // _MSC_VER
+
+#endif // COMPAT_H