On Friday, 11 September 2015 at 04:30:44 UTC, Prudence wrote:

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).

The subsystem is set at link time, so there is no reliable way at compile time to determine the configuration. A simple and cheap runtime check can be made like this:

import core.sys.windows.windows : GetConsoleCP;
bool hasConsole = !!GetConsoleCP();


Reply via email to