Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd __acrtused error with WinMain #18592

Closed
dlangBugzillaToGithub opened this issue May 30, 2013 · 1 comment
Closed

Odd __acrtused error with WinMain #18592

dlangBugzillaToGithub opened this issue May 30, 2013 · 1 comment

Comments

@dlangBugzillaToGithub
Copy link

Andrej Mitrovic (@AndrejMitrovic) reported this on 2013-05-30T04:38:17Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=10213

Description

-----
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.
@thewilsonator
Copy link
Contributor

OPTLINK is no longer supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants