On 26 January 2015 at 17:50, Liran Zvibel via D.gnu <d.gnu@puremagic.com> wrote: > Hi, > > I would like to use some D code in a C binary > . > Part of the D functionality used is by instantiating templated structs. > > Even if I just try to compile the following simple code: > > extern (C) { > alias mytpye = BLA!(int); > struct BLA(T) { > T x; > } > } > > With the following gcd flags: > -fno-invariants -fno-in -fno-out -fno-bounds-check -O3 -fno-assert -c > -nophoboslib -nostdlib >
-frelease -O3 -c does the same as -fno-invariants -fno-in ... > I still have 3 undefined symbols: > _D10TypeInfo_i6__initZ _D15TypeInfo_Struct6__vtblZ _Dmodule_ref > > I can alway just define them in the C glue code and get it over with, but I > would like to understand what I SHOULD do to get it to easily link into a > normal C executable. > There is work underway to talk about what will need to be done to implement @notypeinfo or a similarly named attribute. Until then you need to link against libdruntime - or a library that provides a minimal implementation/stubs (ie: minlibd) As I'm typing this, I can see Mike has replied, probably with this same answer. :) Iain.