When you compile with -L/SUBSYSTEM:WINDOWS you're essentially building an app without a console, so if you want to print out messages you'd have to log them to a file. For example:
----- import core.sys.windows.windows; import std.stdio; extern(Windows) HWND GetConsoleWindow(); void main() { if (!GetConsoleWindow()) { stdout.open(r".\stdout.log", "w"); stderr.open(r".\stderr.log", "w"); } try { realMain(); } catch (Throwable thr) { stderr.writeln(thr.msg); throw thr; } } void realMain() { assert(0); } ----- Compilable and runnable with: dmd -g -L/SUBSYSTEM:WINDOWS:5.01 -run test.d This will write the exception message to a log file, however I'd also like to retrieve the stack trace to log that as well. For example here's the output in a regular console app (without the windows subsystem): core.exception.AssertError@test(29): Assertion failure ---------------- 0x0041D93B in onAssertError 0x004020DD in void test.realMain() at C:\dev\code\d_code\test.d(30) 0x0040208B in _Dmain at C:\dev\code\d_code\test.d(18) 0x00417BE8 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C ) int function(char[][])*).void runMain() 0x00417C78 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C ) int function(char[][])*).void runAll() 0x00417555 in _d_run_main 0x00408690 in main 0x0042DD29 in mainCRTStartup 0x774F33CA in BaseThreadInitThunk 0x77D09ED2 in RtlInitializeExceptionChain 0x77D09EA5 in RtlInitializeExceptionChain I'd like to log this out when building with a windows subsystem. Is there any way to do that?