lua-users home
lua-l archive

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



On 20 Sep 2016, at 14:37, Viacheslav Usov <via.usov@gmail.com> wrote:

On Tue, Sep 20, 2016 at 9:55 AM, Shmuel Zeigerman <shmuz@013net.net> 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.

Cheers,
V.



The most common problem is passing objects around (file handles etc.) their internal structures have changed in between versions and hence can cause trouble.

see https://msdn.microsoft.com/en-us/library/ms235460(v=VS.100).aspx

Thijs