Necessity of D Library (and/or Core Library)
lobo via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 23 04:01:44 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?
>
> I have become very interested in how programming languages
> do their magic; how they interact with the computer itself, and
> their inner mechanics. This eventually led me to resources that
> said the line between a language and its library differs
> between languages, and I was wondering where D stood on that
> line.
>
> 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.
>
> P.S. I'm only a freshman computer science student, so if some
> of this should be basic, I simply don't know it yet.
>
> Thanks in advance!
I have some bare metal code that works without Druntime.
The compiler injects code that references some druntime
components, which causes the linker to barf if they're not
defined somewhere. You can simply define them as global void*
vars like so:
---
module kernel.kmain;
// So we compile without druntime.
extern(C) __gshared void* _d_dso_registry;
extern(C) __gshared void* _Dmodule_ref;
extern(C) __gshared void* _d_arraybounds;
extern(C) __gshared void* _d_assert;
extern(C) __gshared void* _d_unittest;
// rest of code here
---
This was back in DMD 2.065 so things may have changed between
then and now.
bye,
lobo
More information about the Digitalmars-d-learn
mailing list