Solutions to the TypeInfo dependency injection issue?
Walter Bright
newshound at digitalmars.com
Thu Mar 8 14:18:09 PST 2007
kris wrote:
> Walter Bright wrote:
>> kris wrote:
>>
>>> What about (c) how templates are affected at each step ?
>>
>>
>> It's the same algorithm - nothing special about templates.
>
> Is it possible, do you think, to be just a little more forthcoming on this?
>
> 1) when you batch-compile code with multiple references to a template,
> there is just one instance generated.
Yes.
> 2) when you compile the same code modules individually, there are
> presumably multiple template instances generated?
Yes.
> 3) how does the linker resolve the multiple template instances to just one?
The template instantiations are put into COMDAT sections, and the linker
discards redundant ones.
More information about the Digitalmars-d
mailing list