Bug 4341 – compiling with -unittest on win32 produces invalid executable

Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-06-17T07:49:00Z
Last change time
2011-07-09T23:26:16Z
Assigned to
nobody
Creator
michal.minich

Comments

Comment #0 by michal.minich — 2010-06-17T07:49:05Z
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"); }
Comment #1 by adrian — 2010-08-11T04:51:01Z
Seems like it's fixed in 2.048. Compiles and runs correctly with and without unittests.
Comment #2 by yebblies — 2011-07-09T23:26:16Z
According to the above comment, this has been working since 2.048