lua-users home
lua-l archive

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


* Dimiter Stanev:

> Nonetheless, the idea of using LuaJIT as FFI embedding device, even
> with JIT turned off is not bad. I'm finding myself now relying on
> this, but soon or later you would hit situation where a callback needs
> to be provided, and that callback would have to be your lua
> function. That is still no implemented yet. (for example - Win32
> RegisterClass with WindowProc, or qsort with sorting function). Also
> one can't reuse the same LuaJIT context for the callback, has to be
> new one.

If you're on an embedded target and there's little risk that someone
will run your code with a different LuaJIT version, you can
selectively switch of the JIT compiler for code which calls into the C
code which end up calling back into Lua, using ffi.off.  Right now,
this will make the callback into the same LuaJIT context safe.