Version for windows/console compilation?
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 11 07:19:37 PDT 2015
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();
More information about the Digitalmars-d-learn
mailing list