DLL symbol identity

Benjamin Thaut via Digitalmars-d digitalmars-d at puremagic.com
Fri May 8 02:37:50 PDT 2015


On Friday, 8 May 2015 at 08:04:20 UTC, Kagamin wrote:
> As I understand, if SomeClass is in some dll, it will be there 
> and be unique. If typeid(SomeClass) loads the symbol address 
> from IAT, it will be the same address as in dll.

No, you don't understand. TypeInfos are stored in comdats. And 
they are only created if needed. So if you have SomeClass there 
is a typeinfo for SomeClass but not all possible typeinfos are 
created. Say you never use const(SomeClass) and then two other 
dlls use const(SomeClass) then each of those two dlls will 
contain a instance of the TypeInfo for const(SomeClass). This 
issue gets even worse with TypeInfos of templated types.


More information about the Digitalmars-d mailing list