Comment #0 by erikas.aubade — 2016-02-05T04:06:14Z
The example windows application given at http://wiki.dlang.org/D_for_Win32 works fine when compiled with the default OMF runtime, but when compiled with -m32mscoff it gives the following error
wintest.obj : error LNK2019: unresolved external symbol _MessageBoxA@16 referenc
ed in function _WinMain@16
wintest.exe : fatal error LNK1120: 1 unresolved externals
--- errorlevel 1120
It also seems to explicitly require a WinMain function--giving a similar unresolved external symbol error--whereas with the OMF runtime, it seems to function fine with void main() {}
Comment #1 by dlang-bugzilla — 2017-06-26T16:17:12Z
For -m32mscoff or -m64, you need to link against user32.lib explicitly - either add "user32.lib" to the compiler command line, or add pragma(lib, "user32") to your program. I'm not sure why it's necessary only when targeting the MS toolchain, though.
Comment #2 by robert.schadek — 2024-12-07T13:36:22Z