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

Commit 9c6ff59

Browse files
committed
Add source structure to README
1 parent f8eefbd commit 9c6ff59

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,30 @@ The runtime library provides the following:
4949
* Unit test, coverage, and trace support code.
5050
* Low-level helpers for compiler-inserted calls.
5151

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.
75+
5276
Issues
5377
------
5478

0 commit comments

Comments
 (0)