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

Commit

Permalink
Merge pull request #3869 from dkorpel/readme-source-structure
Browse files Browse the repository at this point in the history
Add source structure to README
  • Loading branch information
RazvanN7 authored Jul 5, 2022
2 parents f2277d3 + 9c6ff59 commit 8f22b91
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,30 @@ The runtime library provides the following:
* Unit test, coverage, and trace support code.
* Low-level helpers for compiler-inserted calls.

Source structure
------

In the `src` directory, there are `core` and `rt` packages.

The `rt` package contains implementations for compiler-inserted calls.
You may not `import rt.xxx` outside of the `rt` package itself, since its source is not accessible once druntime is compiled;
it isn't included in the `druntime/import` that ships with compiler releases.
The compiler assumes these functions have a specific `extern(C)` signature, and expects them to be linked into the final binary.
See for example: [https://github.com/dlang/dmd/blob/master/src/dmd/backend/drtlsym.d](dmd/backend/drtlsym.d)

The `core` package is shipped with the compiler and has a stable API.
It contains implementations for D features, but also some D conversions of header files from external libraries:
- `core/stdc` - C standard library
- `core/stdcpp` - C++ standard library
- `core/sys` - operating system API

An exception to the public API is `core.internal`, which contains compiler hooks that are templates.
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:
[Replace Runtime Hooks with Templates](https://github.com/dlang/projects/issues/25)

Since uninstantiated templates aren't compiled into the druntime binary, they can't be in `rt`.
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.

Issues
------

Expand Down

0 comments on commit 8f22b91

Please sign in to comment.