Henk Boom wrote: > I'm encountering this issue as well. I know that in vanilla lua > longjump is used to handle errors, which would seem to be compatible > with how libpng wants you to handle errors (i.e. their default error > handler does this), but I've heard that luajit does more complicated > things to interoperate with c++ and such. Is this a safe thing to do? As Florian said, you need to use jit.off(func) for the Lua function that has the code that calls into the C function that may eventually call back into Lua. Whether that Lua code throws an error or not is orthogonal to the callback problem. Throwing errors across C frames is fine. For C++, the rules in http://luajit.org/extensions.html#exceptions apply. --Mike