[Issue 10213] New: Odd __acrtused error with WinMain

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 30 04:38:18 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10213

           Summary: Odd __acrtused error with WinMain
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Keywords: link-failure
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-05-30 04:38:17 PDT ---
-----
import core.sys.windows.windows;

extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
iCmdShow)
{
    version(OK)
    {
        try
        {
            return 0;
        }
        catch (Throwable)
        {
            return 0;
        }
    }
    else
    version(OK2)
    {
        import std.stdio;
        return 0;
    }
    else
    version(FAIL)
    {
        return 0;
    }
}
-----

$ dmd -version=OK -L-Subsystem:Windows:4 test.d
> 

$ dmd -version=OK2 -L-Subsystem:Windows:4 test.d
> 

$ dmd -version=FAIL -L-Subsystem:Windows:4 test.d
> OPTLINK (R) for Win32  Release 8.00.12
> Copyright (C) Digital Mars 1989-2010  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> OPTLINK : Warning 23: No Stack
> test.obj(test)
>  Error 42: Symbol Undefined __acrtused
> OPTLINK : Warning 134: No Start Address

The error seems to go away if you either introduce a try/catch or an import
into any 'std' module.

Obviously the chances of having no imports and no try/catch in a module
implementing WinMain are very low, but the behavior is strange.

-- 
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