<p><br>
On Dec 1, 2013 8:25 AM, "Mike" <<a href="mailto:none@none.com">none@none.com</a>> wrote:<br>
><br>
> I finally got a GDC cross-compiler compiled, and I'm currently trying to test it.  My simple "hello world" program does not use any D runtime features, and I was able to compile it with LDC -noruntime -nodefaultlib.<br>

><br>
> However, when I try to use GDC, I get...<br>
><br>
> "cannot find source code for runtime library file 'object.d'"<br>
><br>
> Are there similar options in GDC to disable the D runtime, or will I have to write stubs?<br>
><br>
> And, does GDC have any D-specific options?<br>
></p>
<p>You will require at least an object.d file to provide stubs - minilibd sbould be sufficient IIRC. </p>
<p>There is -nodefaultlibs, or -nostdlib (which bypasses libgcc also). However, the compiler may generate calls to memcmp, memset, memcpy and memmove.  So these should be provided for if you are not linking against some sort of libc.</p>

<p>If you are linking against libc, and just don't want phobos, then there is -nophoboslib.  This will also omit linking to druntime as currently there are bundled as one library. </p>
<p>You also have -nostartfiles if you wish to also provide for the crtstart.o/crtend.o startup files.</p>
<p>Currently there is no way to interface with dmd's -betterC switch. So if you don't want moduleinfo tidbits to be written, then you'll have to patch the compiler (d-lang.cc: d_init_options) - I can of course get this in as soon as possible .  I'm not sure of ldc's -noruntime switch, but I am going to assume its functionality and say there is no equivalent in gdc.  What would be nice though is a warning on any operations that cause implicit allocation/external calls.</p>

<p>Regards<br>
-- <br>
Iain Buclaw</p>
<p>*(p < e ? p++ : p) = (c & 0x0f) + '0';</p>