Hello,

I'm cross-compiling my Go application to Windows and I'm having difficulty 
understanding how Windows interacts with stdout.

I'm compiling the Windows binary with the "-H=windowsgui" LD flag. This 
works great but I've found that the program will never print to stdout, 
even if the program is launched from the command prompt

The alternative LD flag "-H=windows" will print to stdout but with the 
downside that a "DOS" window will always open, even if the program is 
launched from the desktop icon and even when there is no stdout activity.

For the most part, compiling with "-H=windowsgui" is fine but occasionally 
it's useful for users to run with the program's -log option, which outputs 
to stdout.

My solution for now is to have two Windows binaries. One for regular use 
and another for diagnosing problems. This is a poor solution.

What I require is a single binary that can:

1) Launch from the desktop icon without a "DOS" window opening.
2) To launch from a command prompt and for stdout to be echoed to the 
command prompt window.

Is there a Go compilation option that I've missed. Or is the solution more 
complex?

Regards

Stephen

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/86d55289-b436-452e-b86e-95949af4ea3dn%40googlegroups.com.

Reply via email to