Windows: SUBSYSTEM:WINDOWS, wWinMainCRTStartup and linker behavior

Adam D. Ruppe destructionator at gmail.com
Sun Jun 7 01:55:44 UTC 2026


On Saturday, 6 June 2026 at 23:09:06 UTC, Alexander wrote:
> So I added
> ```
> "dflags": ["-L/SUBSYSTEM:WINDOWS", 
> "-L/ENTRY:wWinMainCRTStartup"],
> ```

I suggest you just use a D main and do not attempt to write your 
own WinMain (or wWinMan). There's no need for that. You can use 
the (w)mainCRTStartup entry point. Not having a D main will make 
the compiler assume you're doing some betterC nonsense and you 
lose a bunch of conveniences. And you have to copy/paste druntime 
boilerplate. Not beneficial.

Note that with OpenD this is all encapsulated in `--target=gui` 
command line option. You can even embed icons with 
`--icon=big.png,small.png` (sample filenames) and cross-compile 
from linux all with simple setup!


More information about the Digitalmars-d-learn mailing list