D: pay for what you use?

Adam D. Ruppe destructionator at gmail.com
Thu Feb 13 09:14:04 PST 2014


On Thursday, 13 February 2014 at 17:04:44 UTC, Rel wrote:
> 1) Is it possible to fully disable exceptions?

Don't implement _d_throw in druntime and they won't link. I'm 
pretty sure the tables are still generated but they won't be used 
(and are pretty small anyway.

> 2) Is it possible to fully disable runtime type information?

alas, not at this time.

> 3) Is it possible to fully disable garbage collection?

Again, just don't implement it and it won't link if you try to 
use it.

> 4) What compiler is better to use when I want to compile and 
> run D on "bare bones" (running code without operating system)? 
> Is it DMD? Or is it LDC? Or GDC?

Any should work since it is more of a linker script question than 
a compiler one; I used dmd for my playing with it but I'm sure 
the others can do the same things.

> 5) Does anyone try to make a tiny druntime library? Did it work 
> out well for you? And can I have a look at it?

http://arsdnet.net/dcode/minimal.zip

That's one with exception support (you can remove that sort of 
with a -version switch but i like exceptions), classes, and much 
the rest of the language but only comes out to ~30 KB executable, 
zero outside dependencies (see also Makefile.bare that can make a 
bare metal image bootable with grub).

It might not compile with the newest dmd, I'm not sure since I 
haven't kept up with the changes over the last several months. 
Ripping out druntime and doing it all yourself is liable to break 
without warning.


An independent try at doing the same thing is here:
https://bitbucket.org/timosi/minlibd

I haven't used it myself though.


More information about the Digitalmars-d mailing list