veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.21k stars 221 forks source link

Don't use -mwindows flag when using static linking on Windows #491

Closed Keithcat1 closed 3 years ago

Keithcat1 commented 3 years ago
The -mwindows flag tells GCC that we want the binary to be a GUI binary and have no command line termina, but there are two reasons it's a problem.
First, normal MinGW ignores it, for example winlibs.com. LLVM-MinGW will properly apply this flag though.
Second, it forces you to stop printing stuff to the console, and if you don't have a panic handler, it silently swallows the panic message and just exits with no indication of what went wrong. Also, Go has its own flag for making GUI binaries "go build --ldflags=-h WINDOWSGUI" has the same effect.
veeableful commented 3 years ago

Thanks @Keithcat1! Does this mean that users who want to statically compile on Windows should include -ldflags=-h WINDOWSGUI in the build command?

Keithcat1 commented 3 years ago

Only if they're building a release version of their app that doesn't need a terminal window.

On 8/20/21, Lilis Iskandar @.***> wrote:

Thanks @Keithcat1! Does this mean that users who want to statically compile on Windows should include -ldflags=-h WINDOWSGUI in the build command?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/veandco/go-sdl2/pull/491#issuecomment-902663325

veeableful commented 3 years ago

I see. I will merge this now and update README.md later with the new information!

Keithcat1 commented 3 years ago

Small edit: It's -H windowsgui, not -h windowsgui.

On 8/21/21, Lilis Iskandar @.***> wrote:

I see. I will merge this now and update README.md later with the new information!

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/veandco/go-sdl2/pull/491#issuecomment-903207646

veeableful commented 3 years ago

@Keithcat1 Ah! Thank you. I will correct it in the README.