www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4341] New: compiling with -unittest on win32 produces invalid executable

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4341

           Summary: compiling with -unittest on win32 produces invalid
                    executable
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: michal.minich gmail.com



PDT ---
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");
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4341


Adrian Matoga <epi atari8.info> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |epi atari8.info



Seems like it's fixed in 2.048. Compiles and runs correctly with and without
unittests.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 11 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4341


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |WORKSFORME



According to the above comment, this has been working since 2.048

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 09 2011