Mimimal runtime library

Sean Kelly sean at invisibleduck.org
Thu Apr 3 16:40:58 PDT 2008


== Quote from Frits van Bommel (fvbommel at REMwOVExCAPSs.nl)'s article
> Lukas Lädrach wrote:
> > Hi everybody,
> >
> > I'm looking for the absolute minimal set of files in phobos i _need_ to run a full featured D application.
> > This means that I don't want to have any unneeded functionality in these files, only the framework to make the
language complete.
> >
> > For me, this would mean:
> > - Object and Interface base
> > - Type info
> > - Exception handling
> > - Startup system (ctor/dtor handling, __main, _main)
> >
> > Only as stubs
> > - GC
> > - System interface
> > - Stdc lib
> > - Thread
> >
> > Has someone an idea? Walter?
> Tango has this stuff separated; you may want to take a look at
> <http://www.dsource.org/projects/tango/browser/trunk>, especially
> lib/compiler/* (and lib/gc/stub/gc.d for malloc/free 'GC', easily
> modified if needed).
> You'll probably also want at least part of lib/common/*. For example,
> Exception.d includes some error handler functions called by
> lib/compiler, and the definitions of the exception classes they throw.

The minimum you need to run a D application is basically what's in the
Tango runtime.  This is built as tango-base-dmd.lib for Win32 users
and libtango-base-dmd.a for Linux users (swap "dmd" for "gdc" if you're
using GDC).  As far as headers go, any .di header in the Tango user space
generally represents something in the runtime.  The principal components
include:

tango.core.Exception
tango.core.Memory
tango.core.Runtime
tango.core.Thread

Also, if you're on Win32, you'll find that tango-win32-dmd.lib is pulled in
as well.  This library backs what's in tango.sys.win32, and I believe it isn't
actually necessary for a bare-bones D application on Windows.  The choice
to hook things together this way occurred before we had a user-level
library, and I can't recall if it was purely for convenience or if there was a
functional reason for this decision as well (I think it was the former though).

If this is still too much baggage and/or you want to want to mess with the
runtime itself, this is a good place to start:

http://www.dsource.org/projects/tango/wiki/TopicAdvancedConfiguration

that doc a bit out of date, but the concepts haven't changed, only the names
of the libraries.  "phobos.lib" has been renamed to "tango-base-dmd.lib" for
example.

If you're bent on using Phobos however, the division is far less clear.  You will
need everything in internal, plus std/typeinfo/*, std.thread, and a smattering
of other modules in std--basically any module that contains a function with
the prefix "extern (C) _d_..."  From memory, this includes std.asserterror,
std.moduleinit, and std.outofmemory, and a a few others.


Sean



More information about the Digitalmars-d mailing list