Get compile time string of dmd command line options "-os" & "-target"

Dennis dkorpel at gmail.com
Sat Aug 3 12:15:46 UTC 2024


On Thursday, 1 August 2024 at 04:00:08 UTC, An Pham wrote:
> pragma(msg, os.stringof...?);
> pragma(msg, target.stringof...?);

There's no built-in way, but you can define it yourself in a 
helper module:

```D
version(Windows)
     enum os = "windows";
else version(AArch64)
     enum os = "aarch64";
else
     static assert(0, "unsupported os");
```



More information about the Digitalmars-d-learn mailing list