Using stdin/out in a windows application bugs only when compiled to 64bit.
realhet
real_het at hotmail.com
Thu Jun 7 19:19:55 UTC 2018
Hi,
The following narrow test program works fine when compiled with
DMD to 32bit target:
import std.stdio, core.sys.windows.windows, core.runtime;
extern(Windows) int WinMain(HINSTANCE hInstance, HINSTANCE
hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
{
Runtime.initialize;
writeln("Hello");
stdout.flush; //exception
readln; //exception
return 0;
}
It shows the console window and waits for user input at readln.
If I try to compile this to 64bit target or with LDC (both 32 and
64) it gets privileged instruction exception at stdout.flush. If
I comment out flush then it fails at readln.
Is there a way to fix this? I don't wanna lose the console window
even on 64bit.
Thanks!
More information about the Digitalmars-d-learn
mailing list