From: klaas.holwerda <kho...@xs...> - 2005-12-29 14:28:08
|
Hi John, First would you think it is possible to debug into lapi.c using VC IDE? As soon as i arrive in this code breakpoint do not work, and my program is stuck. I have my bindings added as below, but i can't get it to work. Meaning wxLuaState::RunFile() gets stuck in wxLuaState::LuaDoFile() at the lua_pcall statement. And i can not go into it. This is also the case in wxLua itself, i don't understand why. e.g. I have the next aaaa.lua file, the first statement works, it shows the message box. But for the rest nothing is done, the functions in my binding are not called. wx.wxMessageBox( 'This is the "About" dialog of the Scribble wxLua Sample.', "About wxLua", wx.wxOK + wx.wxICON_INFORMATION ) wx.a2dLuaWP:Message("blah blah") wx.a2dLuaWP:FileOpen("../drawings/polygons.cvg") How does one check if binding work somehow, or where and for what reason it is not done? Can you give me a handy breakpoint, to see what is going on? John Labenski wrote: >Can you not do this at all, because it is in a library? I thought this >would be a clever trick to ensure that all the bindings were >initialized and made available at runtime. This way you do not have to >know the name of anything and so we can even remove the dependence on >the wxWidgets binding. > > I understand it, and i think it should be possible. (it is already happening from the wxlua libs itself, so why not mine. But the order of initialization is a problem still, even if it would work. Depend on initialization order is a bit risky. I have here simular modules, and i use derived wxModule classes to make sure everything get properly initialized. Even there the order is not always clear, but for that i set a flag in lower order modules and call them in higher module initalizations , so in the end the order is fine. >What would be an alternative? > Maybe wxModule like initialization? >One way would be to make the user add >any bindings they want to a static member of wxLuaBinding themselves >in the wxApp::OnInit. > That is what i do now. I make the binding a static member of MyApp. class MyApp { static wxart2d_binding m_wxart2dluab; } wxart2d_binding MyApp::m_wxart2dluab; and in onInit() m_wxart2dluab.GetBindingList()->Append( &m_wxart2dlaub); >The only reason to have the static member is so >that they don't have to always add the bindings everytime they create >a new wxLuaState, but by default it will try to load the ones set to >the static wxList of them. > > I see in wxLuaStateRefDate that those static wxLuaBinding::GetBindingList() is added to the real/actual bindings of the wxLuaState. I assume that is what you are saying. Regards, Klaas > > > > > > |