druntime vs phobos

Sean Kelly sean at invisibleduck.org
Wed Feb 1 19:29:49 PST 2012

On Feb 1, 2012, at 5:33 PM, Mattbeui wrote:

> Hi,
> What are the main differences between these two libs?

Druntime contains all the code that every D app needs to run.  This includes routines called by compiler-generated code, the garbage collector, and thread support (needed so the GC can find and scan user threads).  Phobos is the D standard library and its use is completely optional, though it's linked by default by DMD.

> 1) Using D2 I need both?

Strictly speaking: no.  You can use --defaultlib=druntime and --debuglib=druntime to avoid linking Phobos, assuming that you have the druntime library available.

> 2) Where phobos replaces druntime and vice-versa?

There are a few instances where Phobos aliases stuff in Druntime, but this is typically for compatibility reasons.  There should be little to no overlap in functionality between the two.  Think of core (druntime) as being roughly equivalent to java.lang.

More information about the Digitalmars-d mailing list