Dan Haffey <dan@theproverbial.com> writes:
I'm not sure if this is even the right place to post this question, but I'm having some trouble with inheritance across shared library boundaries. I've read the CrossExtensionModuleDependencies Wiki node, and I assume that my problem stems from std::type_info comparison problems, so my question is basically: how do I go about making sure my RTTI info is all coming from the same place?
I'm specifically referring to this snippet from the Wiki: "The best way to achieve that is to link both extension modules to a common shared library using the global model, and put the RTTI information there."
I'm not sure how exactly I get all the relevant RTTI information into that third library.
Put the base classes there. What it takes to generate the RTTI information will vary from compiler-to-compiler. Usually implementing one virtual function there is enough. Sometimes even a non-virtual function is sufficient. If your base classes have only pure virtual functions, you can still provide an implementation for one. If all else fails, you might try putting a dummy function in that library that uses dynamic_cast<Derived*>(some_base_ptr). Good luck! -- Dave Abrahams Boost Consulting www.boost-consulting.com