c++ - What is vtable anchoring, and how does it work in a shared object? -
i performing research issues c++ library , ensuring type information consistent between application , shared object. i'm interested in ensuring equalobject comparison works, meaning indeed have same object, , not 2 objects happen equal under operator== . this answer state anchor vtable in header. i'm not familiar technique. or i've heard called name. what vtable anchoring, , how work? i'm aware of dynamic_cast, throw, typeid don't work shared libraries gcc faq. it's non-standard technology, problem clear: translation unit should contain vtable? if virtual destructor isn't inlined, defined in 1 translation unit, , it's easy choice put vtable there. for portable code, pretty irrelevant. wouldn't care duplicate vtables.