Windows: SUBSYSTEM:WINDOWS, wWinMainCRTStartup and linker behavior

Alexander roland.taverner at gmail.com
Sat Jun 6 23:09:06 UTC 2026


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.


More information about the Digitalmars-d-learn mailing list