Re: add_dependency assert problem

Ryan Pavlik <[email protected]> Wed, 17 Aug 2011 09:52:45 -0500
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <CABMFTE8-AJ+ha34QWd+xAKRJZrv72wGEEg=ZyGVyfzD=vddcQg@mail.gmail.com>
Try this: Define a virtual destructor in class base. It can be trivial: that
is, ~base() {}


On Wed, Aug 17, 2011 at 5:22 AM, 锋 <[email protected]> wrote:

> hi, all:
>
> i get *assertion* error in *object_rep*.cpp -- "assert(m_dependency_cnt <
> sizeof(object_rep));" when i use luabind like this example:
>
> ----------------------
>
> class base
> {
> public:
>     virtual void print() {}             // if not use 'virtual', the
> m_dependency_cnt will not bigger than sizeof(object_rep)
> };
>
> class derived : public base {};
> class derived_wrap : public derived, public wrap_base {};
>
> class holder
> {
> public:
>     base* member;
>
>     holder(base* p) : member(p) {}
> };
>
> module(L)
> [
>     class_<base>("base")
>         .def(constructor<>())
>         .def("print", &base::print),
>
>     class_<derived, derived_wrap, base>("derived")    // i want the
> "derived" in lua can be derived and also have base class "print" function
>         .def(constructor<>()),
>
>     class_<holder>("holder")
>         .def(constructor<base*>())
>         .def_readonly("member", &holder::member)
> ];
>
> luaL_dostring(L,
>     "a = derived() "
>     "b = holder(a) "
>     "for i = 1, 100 do "
>     "    b.member:print() "
>     "end "
> );
>
> ----------------------
>
> any ideas? thanks in advance
>
> onlyfeng
> [email protected]
>
>
>
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> user administration capabilities and model configuration. Take
> the hassle out of deploying and managing Subversion and the
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
>


-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

[email protected]
http://academic.cleardefinition.com

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user