www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22805] New: [Reg 2.099] missing libraries when using some

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 puremagic.com
          Reporter: r.sagitario 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 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. --
Feb 21 2022