> #define LUA_API extern "C++"
The reason why I have settled on extern "C" is that I also use libraries built in C, which would otherwise be impossible to link with.
If you're mixing C and C++ interfaces throwing a Lua error becomes a problem:
- if you use 'longjmp' you don't perform proper stack unwinding and destruction in C++ code.
- if you use 'throw' the result is system dependent, the result of unwinding a stack with mixed C and C++ stack frames is probably not properly defined.
It may work on some platforms (like Windows with its structured exception handling), but it's not portable. C++ ABIs are also not the most stable, what works today may break tomorrow.