|
| 1 | +# Installing a D Compiler |
| 2 | + |
| 3 | +To run D code you first need to build it. To build it a compiler must be |
| 4 | +installed on the system. |
| 5 | + |
| 6 | +There are several D compilers to choose from, you can find a list of them under |
| 7 | +https://dlang.org/download.html |
| 8 | + |
| 9 | +## DMD |
| 10 | + |
| 11 | +DMD is the official reference compiler for D. It always implements the latest |
| 12 | +features and the latest standard library + runtime. Additionally it is the |
| 13 | +fastest compiler out of the 3, although it doesn't produce the fastest |
| 14 | +executables. It's a good compiler for prototyping and quick scripts and is the |
| 15 | +recommended compiler to get if you don't know which one to get. |
| 16 | + |
| 17 | +Download: https://dlang.org/download.html#dmd |
| 18 | + |
| 19 | +## LDC |
| 20 | + |
| 21 | +LDC is an LLVM-based (like clang) D compiler. It supports a variety of operating |
| 22 | +systems and target architectures and has very frequent releases, usually being |
| 23 | +up-to-date to the DMD reference compiler within days. It takes longer to compile |
| 24 | +executables but results in much better optimized executables than with DMD. LDC |
| 25 | +is a good compiler to be using in production to create executables. |
| 26 | + |
| 27 | +Installation (package manager): https://github.com/ldc-developers/ldc#installation |
| 28 | + |
| 29 | +Download (executables): https://github.com/ldc-developers/ldc/releases |
| 30 | + |
| 31 | +## GDC |
| 32 | + |
| 33 | +GDC is an GCC-based D compiler. Other than the other compilers it comes built-in |
| 34 | +into GCC and does not require a separate installation. It supports a variety of |
| 35 | +operating systems and target architectures. Being tied to GCC's release schedule |
| 36 | +it is often behind in new features but receives bug fix backports from later |
| 37 | +versions in minor updates. GDC could be called the most stable compiler as it is |
| 38 | +tied to specific D frontend versions for a while, only fixing issues without big |
| 39 | +changes. GDC is a good compiler to be using in production to create executables. |
| 40 | + |
| 41 | +GDC is included in GCC since GCC 9.0, installing a recent GCC version should |
| 42 | +have it included by default. |
| 43 | + |
| 44 | +For Linux distributions packaging the backends in different packages or Windows |
| 45 | +downloads see https://www.gdcproject.org/downloads |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +The installation packages of DMD and LDC come with various utilities (DUB, rdmd) |
| 50 | +installed. If you don't have these utilities because you used your Operating |
| 51 | +System's package manager or installed GDC, code-d will download the executables. |
0 commit comments