WIP try to use MSVCRT.DLL instead of UCRT

Very simple "hello world" style programs work.
This commit is contained in:
Ayke van Laethem
2025-04-07 15:09:32 +02:00
parent e95d56f749
commit bd7594a0ff
5 changed files with 112 additions and 39 deletions
+13 -3
View File
@@ -391,15 +391,25 @@ func (c *Config) LibcCFlags() []string {
case "mingw-w64":
root := goenv.Get("TINYGOROOT")
path, _ := c.LibcPath("mingw-w64")
return []string{
cflags := []string{
"-nostdlibinc",
"-isystem", filepath.Join(path, "include"),
"-isystem", filepath.Join(root, "lib", "mingw-w64", "mingw-w64-headers", "crt"),
"-isystem", filepath.Join(root, "lib", "mingw-w64", "mingw-w64-headers", "include"),
"-isystem", filepath.Join(root, "lib", "mingw-w64", "mingw-w64-headers", "defaults", "include"),
"-D_UCRT",
"-D_WIN32_WINNT=0x0a00", // target Windows 10
}
if c.GOARCH() == "386" {
cflags = append(cflags,
"-D__MSVCRT_VERSION__=0x700", // Microsoft Visual C++ .NET 2002
"-D_WIN32_WINNT=0x0501", // target Windows XP
)
} else {
cflags = append(cflags,
"-D_UCRT",
"-D_WIN32_WINNT=0x0a00", // target Windows 10
)
}
return cflags
case "":
// No libc specified, nothing to add.
return nil