D’s runtime is a recurring hot topic, but there’s obviously a lot of confusion about what the D runtime even is. I gave a quick explanation during my talk at DConf 2017, but I decided to write a blog post because I’ve seen confusion since then, and because I think blog posts are just a much better format for technical stuff, anyway.
It’s a library. You can see it in all its glory in the official git repo. It’s primarily used by the compiler, though sometimes accessing it from application code (i.e., by importing things from core) can be useful, too. This library binary is called something like druntime.so, with the exact file extension depending on your OS and whether you’re linking statically or dynamically. (Note that some D runtime code might get inlined into your main program.)
The compiler’s job is to compile high-level code into low-level machine code. A simple compiler could just keep generating the same machine code for each D feature every time it’s used, in every program, but it obviously makes sense to put some of this code into a library, in exactly the same way that human programmers use libraries to avoid copy pasting.