Version for windows/console compilation?

Prudence via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 10 21:30:43 PDT 2015


On Friday, 11 September 2015 at 01:36:31 UTC, Mike Parker wrote:
> 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.

I'm using Visual D and I assume it takes care of all this. It 
works so that's not a huge problem.

I'm simply creating my own version flags in VD properties. Not 
the best way because I'll have to remember to set the flags every 
time I use the library or I'll get errors about stuff missing. I 
was hoping D had a flag to disambiguate console and windows 
apps(or some type to CT way to check).




More information about the Digitalmars-d-learn mailing list