On Dec 21, 2007 10:31 AM, Klaas Holwerda <[EMAIL PROTECTED]> wrote:
> Hi John,
>
> One of my last bindings is this, which always worked fine.
> I do not get any errors when building the bindings, but when the program 
> start i
> get an error. See the stack dump down here.
> If i remove "%define_pointer a2dMaskProc", the RegisterBindings() fase is 
> fine.
> The function a2dGetMaskProc() return the same pointer, and i tested a few 
> script
> using that instead of a2dMaskProc itself, and they work.
> So i wonder what is going on. When i look at wxlObject->pObjPtr just before 
> the
> call to lua_rawset, it contains the right info as far as i can see.
> It is not the only place i use %define_pointer e.g also in its base class.
> Is that maybe what luaO_rawequalObj sees as a problem??
> I think my bindings are oke, and something else is wrong :-)
> Can you give me some hints, or maybe even better, is this already enough for 
> you
> to find an error in the binding generation?
>
> Regards
> and Happy Christmas to all of you.
>
> Klaas
>
> %class %delete %noclassinfo a2dCentralEditorCommandProcessor
> %endclass
>
> %define_string  a2dMASKPROC_VERSION
>
> %class %delete %noclassinfo MaskprocLuaWrapper, a2dLuaWrapper
>      MaskprocLuaWrapper( a2dCentralEditorCommandProcessor* commandProcessor )
>      bool Exit()
>
>      %define_pointer a2dMaskProc
>
> %endclass
>
> %function MaskprocLuaWrapper* a2dGetMaskProc()
>
>
> Here the stack dump.
>
> luaO_rawequalObj(const lua_TValue * 0x4d678191, const lua_TValue * 0x02005698)
> line 73 + 6 bytes
> luaH_get(Table * 0x02174a30, const lua_TValue * 0x02005698) line 484 + 16 
> bytes
> luaH_set(lua_State * 0x020053a8, Table * 0x02174a30, const lua_TValue *
> 0x02005698) line 495 + 13 bytes
> lua_rawset(lua_State * 0x020053a8, int -3) line 673 + 37 bytes
> wxLuaBinding::DoRegisterBinding(const wxLuaState & {...}, int 1) line 1193 + 
> 11

Find "a2dMaskProc" in the generated C++ code, it should be in a
wxLuaBindObject as {  "a2dMaskProc", g_wxluatag_XXX, NULL, (const
void**)&a2dMaskProc }. Of course, you should be using %define_pointer
if and only if a2dMaskProc is declared in C++ as "MaskprocLuaWrapper*
a2dMaskProc;" and %define_object if this "MaskprocLuaWrapper
a2dMaskProc;".

If the above is not the problem, can you debug this code in
wxLuaBinding::DoRegisterBinding? I'm guessing the problem is in
wxluaT_pushusertag().

    const wxLuaBindObject *wxlObject = m_objectArray;
    for (n = 0; n < m_objectCount; ++n, ++wxlObject)
    {
        lua_pushstring(L, wxlObject->name);

        if (wxlObject->objPtr != 0)
            wxluaT_pushusertag(L, wxlObject->objPtr,
*wxlObject->wxluatype, true);
        else
            wxluaT_pushusertag(L, *wxlObject->pObjPtr,
*wxlObject->wxluatype, true);

        lua_rawset(L, -3);
    }

Hope this helps,
    John

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to