Re: Assertion failure in inheritance.hpp
Nigel Atkinson <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <1286680864.1650.3.camel@octavo> |
Just of the top of my head, what is the value of L after the newstate
call in the static version? Perhaps the Lua call is failing for some
reason? Something to rule out at any rate.
Nigel
On Sat, 2010-10-09 at 14:39 -0400, David Wolfe wrote:
> [This is a resend of a message accidentally sent from the 'wrong' email
> account. Sorry if the list winds up with two copies...]
>
> When I run the program appended below on Windows (Visual Studio 8 2005),
> I get the following:
>
> Assertion failed: m_local_id >= local_id_base, file
> C:\d\OdiGatewayEmulator\luab ind\luabind/detail/inheritance.hpp, line 86
>
> But it seems to work fine on Linux/gcc 4.4.3.
>
> Can anyone explain this? Moving the luabind::open() call inside Init()
> (so that it doesn't get called at static initialization time) makes the
> assertion go away, but I'd like to understand what's going on...
>
> ----------
>
> #include <luabind/luabind.hpp>
>
> struct Base
> {
> virtual void DoIt() = 0;
> };
>
> struct Derived : Base
> {
> lua_State* L;
>
> Derived()
> {
> L = luaL_newstate();
> luabind::open(L);
> }
>
> void Init()
> {
> using namespace luabind;
> module(L)
> [
> class_<Base>("Base"),
> class_<Derived, Base>("Derived")
> .def("DoIt", &Derived::DoIt)
> ];
>
> // This call triggers an assertion failure if *this is static
> globals(L)["thing"] = this;
> }
>
> void DoIt() { }
> };
>
>
> static Derived thing1;
>
> int main()
> {
> thing1.Init(); // <-- This call triggers an assertion failure
> Derived thing2;
> thing2.Init(); // <-- This call is okay
> return 0;
> }
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb