[Issue 22805] New: [Reg 2.099] missing libraries when using some windows API calls with -m32

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 21 23:24:35 UTC 2022


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: nobody at puremagic.com
          Reporter: r.sagitario at gmx.de

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

--


More information about the Digitalmars-d-bugs mailing list