DUB / compiling same source and config to different windows subsystems in 32/64 bit

Mike Parker aldacron at gmail.com
Tue Mar 5 05:03:42 UTC 2019


On Tuesday, 5 March 2019 at 04:32:57 UTC, evilrat wrote:
> On Tuesday, 5 March 2019 at 03:48:22 UTC, Mike Parker wrote:
>> I stopped using WinMain with D a long time ago. It's not 
>> necessary. If you always use `main`, then both linkers will 
>> provide you with a console subsystem app by default. That's 
>> particularly useful during development. You can add a 
>> configuration to your dub.json that turns on the windows 
>> subsystem for both linkers.
>>
>> For OPTLINK (x86) you only need to pass to the linker 
>> `/SUBSYSTEM:windows`.
>>
>> For the MS linker (x86_mscoff, x86_64) you need to that and 
>> you need to specify that the entry point is `main`, because it 
>> will expect `WinMain` when you specify the windows subsystem. 
>> You can do that with `/ENTRY:mainCRTStartup`
>>
>> https://docs.microsoft.com/en-us/cpp/build/reference/subsystem-specify-subsystem?view=vs-2017
>> https://docs.microsoft.com/en-us/cpp/build/reference/entry-entry-point-symbol?view=vs-2017
>
> All of this should be added on dub docs with small snippets and 
> explanation as a section dedicated to Windows and maybe even on 
> D docs as well, because you know, it shows up again and again 
> from time to time

This has nothing to do with dub, so that’s the wrong place for 
it. The dmd for windows docs needs to make clear the distinction 
between the linkers and the differences in behavior, and point to 
the linked docs for options. I just checked the Optlink page and 
didn’t see /subsystem documented, so that needs to be fixed. I’ll 
put it on my todo list.


More information about the Digitalmars-d-learn mailing list