How to set constant value to environment variable at compile time?

Narxa fbf99eQrXpHcjP8L at gmail.com
Mon Dec 10 18:19:37 UTC 2018


On Monday, 10 December 2018 at 17:47:37 UTC, Neia Neutuladh wrote:
> On Mon, 10 Dec 2018 11:08:23 +0000, Narxa wrote:
>> Hello, people!
>> 
>> I would like to have a constant with the value of some 
>> environment variable that is defined at compile time.
>
> In your build script, echo the environment variable into a 
> file. Then import() that file and use the value.
>
>> I know I could possibly use 'gdc' to achieve that but I want 
>> to use the 'dmd' compiler.
>
> Defining variables like that is a language-level feature. gdc 
> supports exactly the same options as dmd.

It worked!

Thank you very much!


More information about the Digitalmars-d-learn mailing list