Skip to content

Commit 77f7ed4

Browse files
committed
Windows: use main()+FreeConsole instead of WinMain to fix MinGW 14.2 locale crash
1 parent 02b377e commit 77f7ed4

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

mode/CppMode.jar

-6 Bytes
Binary file not shown.

src/java/CppBuild.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ private File writeSketchImpl(RunnerListener listener) throws IOException {
15381538
out.append("#include <windows.h>\n");
15391539
out.append("int main() {\n");
15401540
out.append(" #ifdef _WIN32\n");
1541-
out.append(" ::ShowWindow(::GetConsoleWindow(), SW_HIDE);\n");
1541+
out.append(" ::FreeConsole();\n");
15421542
out.append(" #endif\n");
15431543
out.append(" Processing::Sketch sketch;\n");
15441544
out.append(" sketch.run();\n");
@@ -3196,7 +3196,8 @@ else if (!cmd.contains(defaultsCpp.getAbsolutePath()))
31963196
"-lglfw3", "-lglew32", "-lopengl32", "-lglu32",
31973197
"-lcomdlg32", "-lshell32", "-lole32", "-luuid",
31983198
"-pthread", "-D_USE_MATH_DEFINES",
3199-
"-Wl,--subsystem,windows");
3199+
"-Wl,--subsystem,windows",
3200+
"-Wl,--allow-multiple-definition");
32003201
} else if (mac) {
32013202
// macOS: prefer bundled dylibs shipped with the mode (libs/macos)
32023203
// universal dylibs work on both arm64 and x64.

0 commit comments

Comments
 (0)