On Tue, Apr 15, 2008 at 9:23 AM, Adrian Carpenter <[EMAIL PROTECTED]> wrote: > > I am using the latest windows binaries from the wxLua site, I have > generated a simple import library for wx.dll by providing the luaopen_wx > export. > > I call the luaopen_wx function in the same manner that the other lua > libraries are opened (basically a copy of the luaL_openlibs function), > and wxLua is loading and I can quite happily use it, a call to > wx.wxMessageBox promptly opens a messagebox.
This is right. > My simple test case simply does a lua_open, lua_openlibs (including wx), > lua_close. It doesn't actually execute any lua code. When the host > program exits, wx.dll tries to access the lua_state variable (which was > closed long before) and ends up accessing an invalid pointer, and > crashes. It appears to be when wx.dll is unloaded. Can you debug this and let me know where wxLua tries to access the lua_State? Perhaps you could post a backtrace? I assume somewhere in the wxLuaState destructor. Perhaps you have the linking order wrong and Lua is linked after wxLua (but I doubt that the linker would allow that) and when the program exits Lua closes then wxLua closes. When you display a dialog or frame and then close it wxLua will exit the app since that is the normal behavior of a GUI app, i.e. the message loop is exited and there's nothing left to do. Regards, John ps. I will be away again next week so I may not have time to respond quickly. ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users