lua-users home
lua-l archive

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


I'm going back to the common topic of C++ exceptions.

I'm using VS 2005 x86.

Basically I register a C++ function with lua_pushcclosure.
This function does not throw, since it contains a try catch like the one suggested here

What happens is the following


from lua call c closure
throw something
catch (...)
.... back into lua
back in pcall which returns a non zero value

and I then throw a new C++ exception (caught higher in the stack in my app).

The problem is that Visual Studio reports that the 2nd exception is unhandled and basically ignores it.

This works fine with Lua (non jit).
The only way to make it work with lua jit is to ensure that the function calling lua_error does not
contain any try{}catch{} block.
It must be handled by an other function which can signal success or error via standard c methods
(e.g. the return code).
As soon as lua_error is in a function that contains try{}catch{} it fails. Mind you, lua_error is
*outside* the try{}catch{}, *not* in the catch, but still in the same function (like the link above).

Havent tried in linux yet.

Am I talking nonsense?