#4394 closed Bugs (fixed)
assert in void_caster
Reported by: | Owned by: | Robert Ramey | |
---|---|---|---|
Milestone: | Boost 1.44.0 | Component: | serialization |
Version: | Boost 1.43.0 | Severity: | Problem |
Keywords: | serialization assert | Cc: |
Description
There is the static library with two classes, "base" and "derived".
class base { public: base():a(0){}; virtual ~base(){}; private: friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & a; } private: int a; }; class derived: public base { public: derived():b(0){}; virtual ~derived(){}; private: friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & boost::serialization::base_object<base>(*this); ar & b; } private: int b; };
This static library is linked to two dynamic libraries. For example, dll_a.dll and dll_b.dll. When I try to load those dlls in my application (via LoadLibrary), I get assert in void_cast.cpp (225):
std::pair<void_cast_detail::set_type::const_iterator, bool> result; result = s.insert(this); assert(result.second);
Sample project is available upon request.
Change History (3)
follow-up: 3 comment:1 by , 12 years ago
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 11 years ago
Replying to ramey:
For now I'm going to comment out the assert.
When I have time, I'll likely re-enable it with a way to override it.
The problem is that the way the code is structured, you'll have multiple instances of some functions. The best way would be eliminate the source of the problem by structuring code like this:
Hopefully we can generate some additional info via here: http://permalink.gmane.org/gmane.comp.lib.boost.devel/226590
For now I'm going to comment out the assert.
When I have time, I'll likely re-enable it with a way to override it.
The problem is that the way the code is structured, you'll have multiple instances of some functions. The best way would be eliminate the source of the problem by structuring code like this:
class base { public:
private:
private:
};
class derived: public base { public:
private:
private:
};
In dll_derived.cpp
instantiate for archives class used:
template derived::serialize<text_oarchive>(text_oarchive, const unsigned int version); ...