digitalmars.D.learn - Windows without console
- boyd (12/12) Apr 13 2008 Hi,
- Bill Baxter (22/39) Apr 13 2008 I have this in my dsss.conf:
- boyd (12/47) Apr 13 2008 That works. Thanks!
Hi, I've been working on a win32 program for D for a while now. Everything is working fine except that I can't get rid of the console that always pops up when the program starts. I realised that I might have added some code that causes this, so I tested it out with the example at http://www.digitalmars.com/d/1.0/windows.html. Sadly enough I got the same results. I tried adding a .def file as recommended on that page, with no difference. I tried using DMD directly instead of dsss. Still the same. Any ideas as to what could be wrong here? Cheers, Boyd
Apr 13 2008
boyd wrote:Hi, I've been working on a win32 program for D for a while now. Everything is working fine except that I can't get rid of the console that always pops up when the program starts. I realised that I might have added some code that causes this, so I tested it out with the example at http://www.digitalmars.com/d/1.0/windows.html. Sadly enough I got the same results. I tried adding a .def file as recommended on that page, with no difference. I tried using DMD directly instead of dsss. Still the same. Any ideas as to what could be wrong here? Cheers, BoydI have this in my dsss.conf: version(gui) { buildflags += -L/SUBSYSTEM:windows:5 buildflags += -gui } else { buildflags += -L/SUBSYSTEM:console:5 } Build using -version=gui and it works for me. No console created. But then the standard library throws exceptions whenever you try to output something. To fix that I have this inside main.d somewhere. version(gui) { pragma(msg, "Compiling GUI Version"); static this() { // redefine dout,derr,dlog to prevent IO exceptions version(Windows) { std.c.stdio.freopen("Nul", "w", dout.file); std.c.stdio.freopen("Nul", "w", derr.file); } } } --bb
Apr 13 2008
That works. Thanks! ------- On Sun, 13 Apr 2008 11:10:17 +0200, Bill Baxter = <dnewsgroup billbaxter.com> wrote:boyd wrote:ng =Hi, I've been working on a win32 program for D for a while now. Everythi=s =is working fine except that I can't get rid of the console that alway==pops up when the program starts. I realised that I might have added some code that causes this, so I =tested it out with the example at ==http://www.digitalmars.com/d/1.0/windows.html. Sadly enough I got the==same results. I tried adding a .def file as recommended on that page,==with no difference. I tried using DMD directly instead of dsss. Still=But =the same. Any ideas as to what could be wrong here? Cheers, BoydI have this in my dsss.conf: version(gui) { buildflags +=3D -L/SUBSYSTEM:windows:5 buildflags +=3D -gui } else { buildflags +=3D -L/SUBSYSTEM:console:5 } Build using -version=3Dgui and it works for me. No console created. =then the standard library throws exceptions whenever you try to output==something. To fix that I have this inside main.d somewhere. version(gui) { pragma(msg, "Compiling GUI Version"); static this() { // redefine dout,derr,dlog to prevent IO exceptions version(Windows) { std.c.stdio.freopen("Nul", "w", dout.file); std.c.stdio.freopen("Nul", "w", derr.file); } } } --bb
Apr 13 2008