https://issues.dlang.org/show_bug.cgi?id=22805

          Issue ID: 22805
           Summary: [Reg 2.099] missing libraries when using some windows
                    API calls with -m32
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

Not a big issue, but compiling and linking this file:

module win;
import core.sys.windows.windows;

void main()
{
        MessageBoxA(null, "hi", "there", MB_OK);
}


with

> dmd -m32 win.d

used to work, but after the change to COFF by default, it produces

win.obj : error LNK2019: unresolved external symbol _MessageBoxA@16 referenced
in function __Dmain
win.exe : fatal error LNK1120: 1 unresolved externals

This is caused by not specifiying the library user32.lib on the command line.
In contrast, invoking optlink automatically adds it (and kernel32.lib).

Maybe the same should be done for COFF to avoid breaking existing build
scripts.

--

Reply via email to