Can dmd compile with my own runtime library?
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Thu Aug 23 09:39:53 PDT 2007
Alexander Panek wrote:
> Huang F Guan wrote:
>> undefined reference to `_D11TypeInfo_Aa6__initZ
>>
>> Would you tell me what's this reference about?
>>
>> What's the use of it?
>>
>
> I'm not sure what exactly this is about, I've run in the the same
> problems lately. I think it's some (static) initialization code for
> TypeInfo, or at least that's what the mangled name suggests. Try to add
> an implementation for init in the TypeInfo definition in object.d.
It's not a function. As I think I mentioned in my other post[1], though
perhaps not with so many words, this is part of what DMD emits when it
encounters a class called TypeInfo_Aa (The name used for the result type
of typeid(char[]).
_D<mangled_class_name>6__initZ is normally only the data used to
initialize a new object of that class when it's allocated, but DMD just
pretends it's the body of the object itself for TypeInfo instances it
emits references to when compiling code using typeid(T) or D-style
varargs (since TypeInfo-derived classes shouldn't change at runtime
anyway), so in this case it's more of a "statically allocated object".
Phobos and Tango use a similar trick, but coded with casts in the
library instead of hardwired into the compiler, to throw an
OutOfMemoryException without calling "new" (which obviously might not
work when you're running out of memory).
[1]: Which apparently took so long to type up that these posts were made
in the interim.
More information about the Digitalmars-d
mailing list