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

Neia Neutuladh neia at ikeran.org
Mon Dec 10 17:47:37 UTC 2018


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.


More information about the Digitalmars-d-learn mailing list