Undefined _D10TypeInfo_l6__initZ and _D15TypeInfo_Struct6__vtblZ added when instantiating template structs

Mike via D.gnu d.gnu at puremagic.com
Mon Jan 26 15:21:22 PST 2015


On Monday, 26 January 2015 at 17:50:59 UTC, Liran Zvibel wrote:

> With the following gcd flags:
> -fno-invariants -fno-in -fno-out -fno-bounds-check -O3 
> -fno-assert -c -nophoboslib  -nostdlib
>
> I still have 3 undefined symbols:
> _D10TypeInfo_i6__initZ _D15TypeInfo_Struct6__vtblZ _Dmodule_ref
>

If you're compliling with -nophoboslib, you are also compiling 
without the runtime, not just phobos.  GDC compiles them in one 
library, IIRC.

Therefore, you have to implement those parts of the runtime the 
compiler inserts implicitly.  This includes TypeInfo and 
ModuleInfo.  You can compile with -fno-emit-moduleinfo to get rid 
of the _Dmodule_ref symbol, but there's no equivalent yet for 
TypeInfo.

Depending on what features of D you are employing, you may be 
able to stub out the TypeInfo in your object.d file.  I have an 
example here:
https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki/1.3-Structs. 
  For 64-bit it may need to be different.  See: 
https://github.com/JinShil/druntime_level_0/blob/master/source/object.d

I figured out the size of each `ignore` array by trial and error.

Mike


More information about the D.gnu mailing list