lua-users home
lua-l archive

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

On Thu, Apr 15, 2010 at 02:17:23PM +0200, Mike Pall 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.
> The example works fine for me on Linux/x64, but I can't test this
> easily on Windows. And the sources of luabind and boost are
> incomprehensible, so I'm at a loss what really happens.
> You could attach a debugger to see where it's crashing. The
> interesting path starts somwehere at:
>   luabind::detail::class_rep::static_class_gettable()
> 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).

It doesn't. In this case static_class_gettable() calls lua_error()
directly, with no non-trivial objects alive on the stack, so it should
be longjmp-safe. lua_pcall() returns properly, and then the crash
happens when luabind throws an exception.

FWIW I can reproduce this on my Windows VM, but I have no idea what's

Daniel Wallin
BoostPro Computing