On Thursday, 10 September 2015 at 18:10:43 UTC, Adam D. Ruppe wrote:

BTW it is pretty rare that you should actually write a WinMain in D. The right thing to do in most cases is to write a normal main function. You can still get the windows gui subsystem with a linker flag.

Specifically, add the following when using the Microsoft linker (compiling with -m64 or -m32mscoff):

-L/SUBSYSTEM:windows,6.00 -L/ENTRY:mainCRTStartup

And this when using OPTLINK:

-L/SUBSYSTEM:windows,5.01

The version numbers are optional. I use 6.00 with the MS linker because it covers both 32-bit and 64-bit apps on Vista and later, and is the default for the VS 2015 linker.

[1] https://msdn.microsoft.com/en-us/library/fcc1zstk.aspx

I don't think I've written a WinMain in D in 10 years.

Reply via email to