diff --git a/CLI/Reduce.cpp b/CLI/Reduce.cpp index 38133e04..721bb51c 100644 --- a/CLI/Reduce.cpp +++ b/CLI/Reduce.cpp @@ -15,7 +15,7 @@ #define VERBOSE 0 // 1 - print out commandline invocations. 2 - print out stdout -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) const auto popen = &_popen; const auto pclose = &_pclose; diff --git a/VM/src/lmem.cpp b/VM/src/lmem.cpp index 3cbdafff..25ca999d 100644 --- a/VM/src/lmem.cpp +++ b/VM/src/lmem.cpp @@ -98,6 +98,8 @@ */ #if defined(__APPLE__) #define ABISWITCH(x64, ms32, gcc32) (sizeof(void*) == 8 ? x64 : gcc32) +#elif defined(__i386__) && defined(__MINGW32__) && !defined(__MINGW64__) +#define ABISWITCH(x64, ms32, gcc32) (ms32) #elif defined(__i386__) && !defined(_MSC_VER) #define ABISWITCH(x64, ms32, gcc32) (gcc32) #else diff --git a/tests/main.cpp b/tests/main.cpp index 9435c61a..3667deb6 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -13,7 +13,7 @@ #ifndef NOMINMAX #define NOMINMAX #endif -#include // IsDebuggerPresent +#include // IsDebuggerPresent, CreateThread #endif #ifdef __APPLE__ @@ -249,6 +249,22 @@ static void setFastFlags(const std::vector& flags) } } +#if defined(_WIN32) +struct thrdarg +{ + int* result; + doctest::Context* ctx; +}; + +DWORD WINAPI testthreadproc(LPVOID param) +{ + auto threadresult = ((thrdarg*)param)->result; + auto context = ((thrdarg*)param)->ctx; + *threadresult = context->run(); + return 0; +} +#endif + int main(int argc, char** argv) { Luau::assertHandler() = testAssertionHandler; @@ -327,7 +343,16 @@ int main(int argc, char** argv) } } +#if !defined(_WIN32) int result = context.run(); +#else + int result; + thrdarg args; + args.result = &result; + args.ctx = &context; + HANDLE testthread = CreateThread(NULL, 0x400000, testthreadproc, &args, 0, NULL); + WaitForSingleObject(testthread, INFINITE); +#endif if (doctest::parseFlag(argc, argv, "--help") || doctest::parseFlag(argc, argv, "-h")) { printf("Additional command line options:\n");