On Thursday, 31 May 2012 at 03:04:58 UTC, tim krimm wrote:
I have been looking at the xomb bare bones (XBB) source code.
It looks like they have a bare bones library, no Phobos.
They used ldc for their compiler.
1) Can the same things be done with the DMD version 2 compiler?
2) Will DMD work without the Phobos library?
3) What minimal set of modules do you need for DMD?
GDC has the -nophoboslib flag. So you can write a D file that
doesn't use druntime or phobos:
extern(C) int puts(const char *);
extern(C) int main()
{
puts("Hello world!");
return 0;
}
and compile it with:
gdc -nophoboslib hello.d
The linker will complain about undefined reference to
_Dmodule_ref. So you need to write a c file like with just "void*
_Dmodule_ref;" in it and compile it to object file with gcc -c
dummy.c. Then you can do
gdc -nophoboslib hello.d dummy.o
And it works.