lua-users home
lua-l archive

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

On Tue, Sep 20, 2016 at 9:55 AM, Shmuel Zeigerman <> wrote:

> As Lua APIs do not use run-time-specific types (such as FILE*), and neither require malloc/free to be called from different sides of an app, why different runtimes should be an issue?

The C language has a bunch of implementation-defined types and macros. A particular runtime will expect a particular set of definitions for those. For example, the jmp_buf type that is required to call setjmp and longjmp is specified to be an array of an unspecified size; it is expressly unspecified whether setjmp is a macro or an identifier with external linkage. Thus any code using setjmp/longjmp compiled for one runtime can be incompatible with another runtime.

Lua uses setjmp/longjmp to raise errors, so it is susceptible to such incompatibilities. Lua can also be compiled using the C++ throw/catch mechanism for that purpose, but that is even more runtime-dependent.