when the "-unittest" switch is not included, applications is compiled. With unittest enabled, after running the resulting exe I receive "... is not valid Win32 application". dmd: 2.047 command line: "dmd -unittest hello.d hello.def" file are: hello.def: EXETYPE NT SUBSYSTEM WINDOWS hello.d: (example from digitalmars website) module hello; import core.runtime; import std.c.windows.windows; extern (Windows) int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int result; void exceptionHandler(Throwable e) { throw e; } try { Runtime.initialize(&exceptionHandler); result = myWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow); Runtime.terminate(&exceptionHandler); } catch (Object o) // catch any uncaught exceptions { MessageBoxA(null, cast(char *)o.toString(), "Error", MB_OK | MB_ICONEXCLAMATION); result = 0; // failed } return result; } int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { return 1; } unittest { assert (1 == 1, "aa"); }
Seems like it's fixed in 2.048. Compiles and runs correctly with and without unittests.
According to the above comment, this has been working since 2.048