https://issues.dlang.org/show_bug.cgi?id=18338
--- Comment #2 from Benjamin Thaut <[email protected]> --- (In reply to kinke from comment #1) > > I guess that's not enough for a shared `typeid(SomeSharedType)` expression > in both a root module of the DLL and in a root module of the other > lib/executable. There probably has to be a clear ownership by emitting the > TypeInfo and its helper functions once in the > declaring/template-instantiating module/object. > > How are colliding TypeInfo symbols across shared objects handled on Linux? The linux shared library mechanism automatically deduplicates duplicated symbols. For linux both the symbol name binding and the address resolving happens at binary load time. For linux the symbol name binding happens at link time and only the address resloving happens at load time. As a result the windows shared library mechanism doesn't deduplicate symbols. The critical part is that the type infos for all user defined types (structs / classes / enums etc) have a clear ownership. E.g. are always emitted alongside the definition of the user defined type. Because these are what is used for casts and other type info critical operations. Other type info such as const array etc can be duplicated without impact. The bug here really is though that the typeinfo will be emitted twice due to the typeid statement. Once when compiling file.d and once when compiling test.d. Emitting it while compiling test.d is a bug in my opinion. --
