Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Getting Started

This is a brief description on getting started with druntime. This is intended for developers, not users.

Building

First, you have to get the DMD compiler (for Linux or Windows); right now, druntime only support DMD. You can choose DMD 1.x or 2.x, but if you choose 2.x you probably need to get the latest bleeding edge version (2.020 as the time of writing).

Once installed, you have to get druntime itself. You need a working subversion installation for that:

svn co http://svn.dsource.org/projects/druntime/trunk druntime

This is for getting the trunk branch, which targets D2. If you wish to get the branch for D1 you can do:

svn co http://svn.dsource.org/projects/druntime/branch/D1.0 druntime

Then just

cd druntime
cd src

and execute the corresponding build script. On windows:

build-dmd.bat

and on Linux / POSIX:

bash build-dmd.sh

Changing the GC implementation

If you want to change the GC implementation used by the druntime, you have to change the src/dmd-posix.mak (or src/dmd-win32.mak for Windows), search for DIR_GC variable and change it from basic to whatever you want, for example, the stub implementation:

DIR_GC=gc/stub

Then, rebuild as shown in the previous section.

Right now there are only 2 implementations: stub and basic, so unless you will be working on your own implementation, there is no much point on changing this =)

Installing

The import files will be published to the import directory and all libraries will be published to the 'lib' directory. The only lib actually needed is druntime-dmd.lib on Windows or libdruntime-dmd.a on Linux. These libraries are also duplicated as druntime.lib and 'libdruntime.a', respectively.

Note: On Windows it is recommended that you either link druntime.lib or rename druntime-dmd.lib to druntime_dmd.lib, because OPTLINK has problems with filenames containing hyphens.

Finally you should rebuild phobos (at least for DMD 2.x) because druntime is included directly in it. To do this you can edit the file src/phobos/linux.mak and change the DRUNTIME variable to point where your runtime library is. For example:

DRUNTIME=/some/path/druntime/lib/libdruntime.a

(remember this should be druntime.lib for Windows)

Then, to rebuild phobos, you should do something like:

make -f linux.mak

for Linux, or:

make -f win32.mak

for Windows. You can specify the path to the DMD compiler to use by setting the DMD variable if necessary. For example:

make DMD=/opt/dmd/bin/dmd -f linux.mak

Our last step is to change your /etc/dmd.conf (or sc.ini on Windows), or create a new one in the directory you want to compile the test stuff, to tell your DMD compiler to use the imports or our fresh druntime (you don't need to change the libs directory, since we've just rebuilt phobos to include the new druntime, and the new phobos library is where the DMD compiler can find it). For example:

[Environment]
DFLAGS=-I/path/to/dmd/src/phobos -I/path/to/druntime/import -L-L/path/to/dmd/lib

Now you can compile your test program using your modified druntime library.