Building 64-bit Windows application with console window

cc cc at nevernet.com
Wed Sep 18 00:13:43 UTC 2019


This might be more a question about the MS linker than D, but I'm 
noticing that when building with -m64 under DMD v2.087.1, it is 
no longer generating a console window when running the 
application.  Under 32-bit, it would always generate the console 
window, and I had to disable it by building with a .def file that 
specified SUBSYSTEM WINDOWS when I no longer wanted it.  Is there 
a way to instruct it to still spawn the console window for 
debugging purposes?

Sample program here: https://pastebin.com/wpLetNKP

rdmd --build-only -debug -g -of"con32.exe" contest.d  ## 
Generates console window and main application window

rdmd --build-only -debug -g -m64 -of"con64.exe" contest.d  ## 
Only generates main application window

I tried adding -L/SUBSYSTEM:CONSOLE to the build arguments but 
then I believe it looks for the wrong entry point and fails:

libcmt.lib(exe_main.obj) : error LNK2019: unresolved external 
symbol main referenced in function "int __cdecl 
__scrt_common_main_seh(void)" (?__scrt_common_main_seh@@YAHXZ)


More information about the Digitalmars-d-learn mailing list