[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [LuaJIT FFI] Tailcalling string.byte() in a callback causes LuaJIT to crash
- From: Duncan Cross <duncan.cross@...>
- Date: Sun, 15 Jan 2012 15:21:45 +0000
On Sun, Jan 15, 2012 at 2:48 PM, Leo Razoumov <slonik.az@gmail.com> wrote:
> On the other hand, casting a Lua-function into a C-function does not
> seem to make much sense. Can it lead to an undefined behavior?
See the FFI Semantics section on callbacks:
http://luajit.org/ext_ffi_semantics.html#callback
(Ordinarily of course, you wouldn't call the created callback yourself
from Lua -- I just did that for minimal demonstration purposes. I can
confirm the same thing happens when it gets called from C.)
-Duncan