Re: [luabind] Re: Luabind and DLLs: Problem with RTTI
Brought to you by:
arvidn,
daniel_wallin
From: Stefan S. <Schwarzbach@SilentDreams.de> - 2005-12-09 15:53:03
|
The problems occur when registering classes. In class.hpp, class_::init(), the following code is executed: class_base::init(LUABIND_TYPEID(T) , detail::internal_holder_type<HeldType>::apply() , detail::internal_holder_extractor<HeldType>::apply(detail::type<T>()) , detail::internal_const_holder_extractor<HeldType>::apply(detail::type<T>()) , detail::const_converter<HeldType>::apply(luabind::get_const_holder(crap)) , detail::holder_constructor<HeldType>::apply(detail::type<T>()) , detail::const_holder_constructor<HeldType>::apply(detail::type<T>()) , detail::internal_holder_destructor<HeldType>::apply(detail::type<T>()) , detail::internal_const_holder_destructor<HeldType>::apply(detail::type<T>()) , detail::internal_holder_size<HeldType>::apply() , detail::get_holder_alignment<HeldType>::apply()); LUABIND_TYPEID(T) stands for &typeid(t) an returns different pointers in different dlls. When a class is comitted, class_base::commit is called and there tries to find the base classes in the list of already registered classes: for (std::vector<base_desc>::iterator i = m_bases.begin(); i != m_bases.end(); ++i) { detail::class_registry* r = detail::class_registry::get_registry(L); // the baseclass' class_rep structure detail::class_rep* bcrep = r->find_class(i->type); detail::class_rep::base_info base; base.pointer_offset = i->ptr_offset; base.base = bcrep; crep->add_base_class(base); } So when I want to register a class classA in a.dll which inherits a class classB registered in b.dll, classA cannot find classB. ClassB is added to the list with typeid(ClassB) called from b.dll. ClassA gets registered with typeid(ClassA) and typeid(classB) as base class, but calles from a.dll. So detail::class_rep* bcrep = r->find_class(i->type) will not find classB, because i->type and the entry in the list come from typeid calls from different calls I hope you understand the problem, Thanks, Stefan |