Skip to content

Commit

Permalink
fix(mingw): fix the windows build with MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Nov 16, 2023
1 parent 1c73db8 commit 24aa297
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 24aa297

Please sign in to comment.