Windows: SUBSYSTEM:WINDOWS, wWinMainCRTStartup and linker behavior

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sun Jun 7 01:39:32 UTC 2026


On 07/06/2026 11:09 AM, Alexander wrote:
> So I added
> ```
> "dflags": ["-L/SUBSYSTEM:WINDOWS", "-L/ENTRY:wWinMainCRTStartup"],
> ```
> to `dub.json`, implemented `wWinMain()` as described at [D for Win32] 
> (https://wiki.dlang.org/D_for_Win32) (I think this needs to be updated 
> for Unicode version, it's no sense to use non-Unicode if you are not 
> programming for Windows 98) and everything was fine until I removed old 
> `main()` function when decided the new one is good enough. After that 
> seems linker just decided to drop all default dependencies including D 
> runtime itself and I got a lot of `unresolved external` errors. It took 
> me some time to figure out what caused this.
> Is this linker behavior intentional? Now I have empty `main()` function 
> to be able to build the app.

This may not be the linkers fault.

main, WinMain, and DllMain are all recognized by dmd as entry points.

It does not appear to support wWinMain, and that would be a bug.



More information about the Digitalmars-d-learn mailing list