Repository: luau-lang/luau (C++)

Issue:
Building with mingw on linux
generates the following error:
```
.../luau/Ast/src/TimeTrace.cpp:18:10: fatal error: Windows.h: No such file or directory
   18 | #include <Windows.h>
      |          ^~~~~~~~~~~
compilation terminated.
```
And I think the compiler is right here. It should be **lower case**.


Discussion: This is a little annoying because Windows SDK uses Windows.h (capital case) canonically, although of course on NTFS you can load a file regardless of the case. Looks like MinGW adopted a lower case version instead. Does changing Windows.h to windows.h fix all the issues?
> Windows SDK uses Windows.h (capital case) canonically

Oh, then i misremembered.

> Does changing Windows.h to windows.h fix all the issues?

No. there are 2 more issue. One is definitely an error in the mingw windows headers:
```
 .../luau/luau/CodeGen/src/CodeBlockUnwind.cpp:68:18: error: ‘RUNTIME_FUNCTION’ {aka ‘struct _RUNTIME_FUNCTION’} has no member named ‘UnwindInfoAddress’
   68 |     runtimeFunc->UnwindInfoAddress = DWORD(sizeof(RUNTIME_FUNCTION)); // Unwind info is placed at the start of the block
      |                  ^~~~~~~~~~~~~~~~~
```
which is caused by them not having `UnwindInfoAddress` as a union over `UnwindData`. [mingw header](https://github.com/mingw-w64/mingw-w64/blob/1b699a6dbcce08b21c4769d90792fa472914b91b/mingw-w64-headers/include/winnt.h#L1885)  [windows docs](https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-runtime_function)

The other one being you "redefining" `popen` and `pclose` . [mingw header](https://github.com/mingw-w64/mingw-w64/blob/c59970ee42411364e0243bd55ada2ec5a1ee545d/mingw-w64-headers/crt/stdio.h#L702-L703)
https://github.com/Roblox/luau/blob/0d6aacf407d25d547ddc93266005e33365f82403/CLI/Reduce.cpp#L20-L21



I deem the Unwind one more problematic since it requires mingw to fix it.

I think I might have a solution for the `RUNTIME_FUNCTION` there in a rewrite I'm working on.
UnwindInfoAddress error has been fixed in https://github.com/Roblox/luau/pull/899



Fix (patch):
diff --git a/Analysis/src/TypedAllocator.cpp b/Analysis/src/TypedAllocator.cpp
index 4dc26219c..a2f49afbd 100644
--- a/Analysis/src/TypedAllocator.cpp
+++ b/Analysis/src/TypedAllocator.cpp
@@ -10,7 +10,7 @@
 #ifndef NOMINMAX
 #define NOMINMAX
 #endif
-#include <Windows.h>
+#include <windows.h>
 
 const size_t kPageSize = 4096;
 #else
diff --git a/Ast/src/TimeTrace.cpp b/Ast/src/TimeTrace.cpp
index 9373fa95d..bc3f3538f 100644
--- a/Ast/src/TimeTrace.cpp
+++ b/Ast/src/TimeTrace.cpp
@@ -15,7 +15,7 @@
 #ifndef NOMINMAX
 #define NOMINMAX
 #endif
-#include <Windows.h>
+#include <windows.h>
 #endif
 
 #ifdef __APPLE__
diff --git a/CLI/FileUtils.cpp b/CLI/FileUtils.cpp
index 39a14ec71..71e536c77 100644
--- a/CLI/FileUtils.cpp
+++ b/CLI/FileUtils.cpp
@@ -10,7 +10,7 @@
 #ifndef NOMINMAX
 #define NOMINMAX
 #endif
-#include <Windows.h>
+#include <windows.h>
 #else
 #include <dirent.h>
 #include <fcntl.h>
diff --git a/CodeGen/src/CodeAllocator.cpp b/CodeGen/src/CodeAllocator.cpp
index 84e48a1b6..50c60fac5 100644
--- a/CodeGen/src/CodeAllocator.cpp
+++ b/CodeGen/src/CodeAllocator.cpp
@@ -13,7 +13,7 @@
 #ifndef NOMINMAX
 #define NOMINMAX
 #endif
-#include <Windows.h>
+#include <windows.h>
 
 const size_t kPageSize = 4096;
 #else
diff --git a/CodeGen/src/CodeBlockUnwind.cpp b/CodeGen/src/CodeBlockUnwind.cpp
index 5c711b4aa..f883d6e30 100644
--- a/CodeGen/src/CodeBlockUnwind.cpp
+++ b/CodeGen/src/CodeBlockUnwind.cpp
@@ -15,7 +15,7 @@
 #ifndef NOMINMAX
 #define NOMINMAX
 #endif
-#include <Windows.h>
+#include <windows.h>
 
 #elif defined(__linux__) || defined(__APPLE__)
 
diff --git a/VM/src/lperf.cpp b/VM/src/lperf.cpp
index 5df22bb09..67befee41 100644
--- a/VM/src/lperf.cpp
+++ b/VM/src/lperf.cpp
@@ -9,7 +9,7 @@
 #ifndef NOMINMAX
 #define NOMINMAX
 #endif
-#include <Windows.h>
+#include <windows.h>
 #endif
 
 #ifdef __APPLE__