lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Apr 15, 2010 at 8:17 AM, Mike Pall <mikelu-1004@mike.de> wrote:
> Yang Fan wrote:
>> I have a C++ program which embeds Lua interpreter and registers
>> several classes, then replace the Lua interpreter dll with
>> LuaJIT2's. The C++ program calls a Lua function which would call
>> C++ functions registered by Luabind, and if the called C++
>> functions are invalid the C++ program may crash, but the
>> officila Lua won't, please see the attachment for example.
>
...
>
> It could be that luabind tries to throw exceptions across Lua
> frames or tries to throw Lua errors across C++ frames protected
> with try/catch (works on Windows/x64, crashes on Windows/x86).
> Or maybe luabind and/or boost need to be compiled with other VC++
> flags for exception interoperation.
>
> You may experiment with setting LUABIND_NO_ERROR_CHECKING or
> LUABIND_NO_EXCEPTIONS in luabind/config.hpp to work around this.
>
>> Also I found wxLua's class member methods working with LuaJIT2
>> have the same problem.
>
> As far as I could glean from the sources, it throws Lua errors deep
> inside some C++ mess. Might be a similar issue.

wxLua should only call luaL_error() from within C callbacks from Lua.
When the Lua program is first executed you are running it from a C++
wxApp class member function and when it is idle you are sitting in a
C++ event loop which may call your Lua callback functions that may
call luaL_error(). wxLua does not use any C++ try/catch/exceptions
anywhere nor does wxWidgets.

Regards,
    John Labenski