Using stdin/out in a windows application bugs only when compiled to 64bit.

realhet real_het at hotmail.com
Fri Jun 8 00:05:00 UTC 2018


On Thursday, 7 June 2018 at 23:25:45 UTC, Steven Schveighoffer 
wrote:
>...

The WinMain exported function works alone well and on 32bit it 
also does the console.
On 64 I also tried AllocConsole, but fail. I get the Console 
handle with GetConsoleHandle, it sends back a nonzero value.

But as I play with it, now I can broke it even when I only use 
main() as export.

This bat file runs(dmd and visual-d installed to default c:\d 
path) (It only affects LDC & win64)
----------------------------------------------------
echo void main(){ import std.stdio; writeln(123); } > test.d
ldmd2 -vcolumns -c -op -allinst -w -m64 -release -O -inline 
-boundscheck=off test.d
call msvcenv amd64
cd c:\d
link /LIBPATH:C:\d\ldc2\lib64 /OUT:test.exe /MACHINE:X64 /MAP 
legacy_stdio_definitions.lib test.obj druntime-ldc.lib 
phobos2-ldc.lib msvcrt.lib
test.exe
----------------------------------------------------

And when I want to run the same exe from outside with 
totalcommander, it brings up an "application was unable to start: 
0xc00000fb exception in a small window o.O.

UPDATE: The exe only starts when "msvcenv.bat amd64" was called 
before. That enironment setter bat file is needed for the exe as 
well o.O

I really thank you for trying to help me. Maybe that other 
different runtime you mentioned is using environment variables to 
be able to start up. Tomorrow I will test it.


More information about the Digitalmars-d-learn mailing list