|
1 | 1 | /**
|
2 |
| -* Configuration options for druntime |
3 |
| -* |
4 |
| -* Copyright: Copyright Digital Mars 2014. |
5 |
| -* License: Distributed under the |
6 |
| -* $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). |
7 |
| -* (See accompanying file LICENSE) |
8 |
| -* Authors: Rainer Schuetze |
9 |
| -* Source: $(DRUNTIMESRC rt/_config.d) |
| 2 | +Configuration options for druntime. |
| 3 | +
|
| 4 | +The default way to configure the runtime is by passing command line arguments |
| 5 | +starting with `--DRT-` and followed by the option name, e.g. `--DRT-gcopt` to |
| 6 | +configure the GC. |
| 7 | +Command line options starting with `--DRT-` are filtered out before calling main, |
| 8 | +so the program will not see them. They are still available via `rt_args()`. |
| 9 | +
|
| 10 | +Configuration via the command line can be disabled by declaring a variable for the |
| 11 | +linker to pick up before using it's default from the runtime: |
| 12 | +
|
| 13 | +--- |
| 14 | +extern(C) __gshared bool rt_cmdline_enabled = false; |
| 15 | +--- |
| 16 | +
|
| 17 | +Likewise, declare a boolean rt_envvars_enabled to enable configuration via the |
| 18 | +environment variable `DRT_` followed by the option name, e.g. `DRT_GCOPT`: |
| 19 | +
|
| 20 | +--- |
| 21 | +extern(C) __gshared bool rt_envvars_enabled = true; |
| 22 | +--- |
| 23 | +
|
| 24 | +Setting default configuration properties in the executable can be done by specifying an |
| 25 | +array of options named `rt_options`: |
| 26 | +
|
| 27 | +--- |
| 28 | +extern(C) __gshared string[] rt_options = [ "gcopt=precise:1 profile:1"]; |
| 29 | +--- |
| 30 | +
|
| 31 | +Evaluation order of options is `rt_options`, then environment variables, then command |
| 32 | +line arguments, i.e. if command line arguments are not disabled, they can override |
| 33 | +options specified through the environment or embedded in the executable. |
| 34 | +
|
| 35 | +Copyright: Copyright Digital Mars 2014. |
| 36 | +License: Distributed under the |
| 37 | + $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). |
| 38 | + (See accompanying file LICENSE) |
| 39 | +Authors: Rainer Schuetze |
| 40 | +Source: $(DRUNTIMESRC rt/_config.d) |
10 | 41 | */
|
11 | 42 |
|
12 | 43 | module rt.config;
|
13 | 44 |
|
14 |
| -// The default way to configure the runtime is by passing command line arguments |
15 |
| -// starting with "--DRT-" and followed by the option name, e.g. "--DRT-gcopt" to |
16 |
| -// configure the GC. |
17 |
| -// Command line options starting with "--DRT-" are filtered out before calling main, |
18 |
| -// so the program will not see them. They are still available via rt_args(). |
19 |
| -// |
20 |
| -// Configuration via the command line can be disabled by declaring a variable for the |
21 |
| -// linker to pick up before using it's default from the runtime: |
22 |
| -// |
23 |
| -// extern(C) __gshared bool rt_cmdline_enabled = false; |
24 |
| -// |
25 |
| -// Likewise, declare a boolean rt_envvars_enabled to enable configuration via the |
26 |
| -// environment variable "DRT_" followed by the option name, e.g. "DRT_GCOPT": |
27 |
| -// |
28 |
| -// extern(C) __gshared bool rt_envvars_enabled = true; |
29 |
| -// |
30 |
| -// Setting default configuration properties in the executable can be done by specifying an |
31 |
| -// array of options named rt_options: |
32 |
| -// |
33 |
| -// extern(C) __gshared string[] rt_options = [ "gcopt=precise:1 profile:1"]; |
34 |
| -// |
35 |
| -// Evaluation order of options is rt_options, then environment variables, then command |
36 |
| -// line arguments, i.e. if command line arguments are not disabled, they can override |
37 |
| -// options specified through the environment or embedded in the executable. |
38 |
| - |
39 | 45 | // put each variable in its own COMDAT by making them template instances
|
40 | 46 | template rt_envvars_enabled()
|
41 | 47 | {
|
|
0 commit comments