Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit e19771e

Browse files
authored
Merge pull request #2146 from wilzbach/config-docs
Expose DRuntime config module header to the docs merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
2 parents bb7e1c0 + aceedb1 commit e19771e

File tree

1 file changed

+39
-33
lines changed

1 file changed

+39
-33
lines changed

src/rt/config.d

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
/**
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)
1041
*/
1142

1243
module rt.config;
1344

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-
3945
// put each variable in its own COMDAT by making them template instances
4046
template rt_envvars_enabled()
4147
{

0 commit comments

Comments
 (0)