Thread overview
[Issue 1067] New: release flag kills Win32 applications without unittest flag?
Mar 18, 2007
d-bugmail
Mar 18, 2007
d-bugmail
Mar 18, 2007
d-bugmail
March 18, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1067

           Summary: release flag kills Win32 applications without unittest
                    flag?
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: rpgfan3233@gmail.com


I've tried creating a simple window using CreateWindowA() from the Win32 API. When I compile without the release switch (-release), everything runs fine. I add the unittest (-unittest) switch and the program still runs fine. However, if you don't include the unittest switch and you DO include the release switch, the window is not displayed, and runs in the background. I tried compiling with warnings on as well. No warnings were generated.

dmd mywin gdi32.lib mywin.def ;OK
dmd mywin gdi32.lib mywin.def -unittest ;OK
dmd mywin gdi32.lib mywin.def -release ;NOT OK
dmd mywin gdi32.lib mywin.def -release -w ;NOT OK with no warnings displayed
dmd mywin gdi32.lib mywin.def -release -unittest ;OK

I ended up going into the dmd\samples\d directory and compiling the winsamp.d file the same way I tried compiling mine. The results were the same, other than the fact that using the -w flag, I found that there was no default case for the nested switch statement in "case WM_COMMAND" in winsamp.d::WindowProc - "switch (LOWORD(wParam))". I added a default case, and it then compiled without warnings.

Is this the way the release switch is supposed to work? Unit tests aren't required, are they?


-- 

March 18, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1067





------- Comment #1 from rpgfan3233@gmail.com  2007-03-18 01:54 -------
Also, this happened on 1.007, which I had at the time. I upgraded to 1.009 hoping that would resolve the issue. It didn't, obviously.


-- 

March 18, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1067


torhu@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |torhu@yahoo.com
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #2 from torhu@yahoo.com  2007-03-18 12:44 -------
Line 78 in winsamp.d:

assert(RegisterClassA(&wc));

Moving 'RegisterClassA(&wc);' out of the assert fixes the problem.

-release removes assert, while -unittest adds them back in.  Your test app probably has the same kind of bug.  An app can't rely on code in asserts, because that code isn't included when compiling in release mode.


--