SiegeLord / Tango-D2

A port of the Tango library to D2
http://siegelord.github.com/Tango-D2/
Other
90 stars 38 forks source link

Stdout infinite loop and crash in Windows program #63

Open jminer opened 10 years ago

jminer commented 10 years ago

With the following program:

import tango.io.Stdout;

extern(Windows)
int MessageBoxW(void* hWnd, const(wchar)* lpText, const(wchar)* lpCaption, uint uType);

void main() {
    Stdout.format("Bye, world").newline;
    MessageBoxW(null, "The program opened.", "Opened", 0);
}

On Windows 7 64-bit, if you compile the program as a Windows program instead of a console program using

rdmd -ofmain.exe -I..\Tango ..\Tango\libtango-dmd.lib -L/EXETYPE:NT -L/SUBSYSTEM:WINDOWS:4.0 main.d

Then when the program is run from the console, the process will go into an infinite loop instead of exiting. If you try double clicking the program in Explorer, it silently dies, presumably because it threw an exception. I tried on Windows XP, and the program opens when double clicked but still goes into an infinite loop at exit.