You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,30 @@ The runtime library provides the following:
49
49
* Unit test, coverage, and trace support code.
50
50
* Low-level helpers for compiler-inserted calls.
51
51
52
+
Source structure
53
+
------
54
+
55
+
In the `src` directory, there are `core` and `rt` packages.
56
+
57
+
The `rt` package contains implementations for compiler-inserted calls.
58
+
You may not `import rt.xxx` outside of the `rt` package itself, since its source is not accessible once druntime is compiled;
59
+
it isn't included in the `druntime/import` that ships with compiler releases.
60
+
The compiler assumes these functions have a specific `extern(C)` signature, and expects them to be linked into the final binary.
61
+
See for example: [https://github.com/dlang/dmd/blob/master/src/dmd/backend/drtlsym.d](dmd/backend/drtlsym.d)
62
+
63
+
The `core` package is shipped with the compiler and has a stable API.
64
+
It contains implementations for D features, but also some D conversions of header files from external libraries:
65
+
-`core/stdc` - C standard library
66
+
-`core/stdcpp` - C++ standard library
67
+
-`core/sys` - operating system API
68
+
69
+
An exception to the public API is `core.internal`, which contains compiler hooks that are templates.
70
+
Many hooks from `rt` use `TypeInfo` class parameters, providing run-time type information, but they are being replaced by template functions, using static type information:
71
+
[Replace Runtime Hooks with Templates](https://github.com/dlang/projects/issues/25)
72
+
73
+
Since uninstantiated templates aren't compiled into the druntime binary, they can't be in `rt`.
74
+
Symbols from `core.internal` can be publically imported from other `core` modules, but are not supposed to be imported or otherwise referenced by end user modules.
0 commit comments