Necessity of D Library (and/or Core Library)

Mike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 23 05:47:09 PDT 2015


On Saturday, 23 May 2015 at 06:35:50 UTC, Anthony Monterrosa 
wrote:
>     Does D require the standard library to function? Or to be 
> more direct, does D as a language need its library, or core 
> library, to function correctly?

There are two main libraries in D:  The D Runtime, and the 
standard library (a.k.a. Phobos)

By default, D links in Phobos and the D Runtime.  With the GDC 
compiler, the two are actually compiled as a single binary.  You 
can disable linking phobos and the D Runtime with the 
-nophoboslib compiler flag.  I'm not sure if DMD or LDC offer a 
similar compiler option.  You could, however, compile to object 
files and then link manually with the system linker to avoid 
linking in phobos and the D Runtime.

If you don't explicitly import anything, then you won't need 
phobos, but you may need the D Runtime depending on which 
features of the language you use.  However, if you stick to a 
C-like subset of D, you need very little of the D Runtime (50~100 
lines of code)

>     Note: since, I'm already here, does anyone know how D 
> manipulates/uses standard streams to make its write/read 
> functions as well? I can't find any resources telling me a 
> non-abstracted way of this being completed.

It is my understanding that D links in the C standard library and 
leverages the functionality there for standard streams.

Mike


More information about the Digitalmars-d-learn mailing list