[Issue 4341] New: compiling with -unittest on win32 produces invalid executable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 17 07:49:07 PDT 2010


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 at puremagic.com
        ReportedBy: michal.minich at gmail.com


--- Comment #0 from Michal Minich <michal.minich at gmail.com> 2010-06-17 07:49:05 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: -------


More information about the Digitalmars-d-bugs mailing list