This spec is really big on FFI exposing functions. I always find it an edge case when trying to play with certain technologies (like the one in the article).
Sorry for the late reply, lost the tab for a bit ._.
Something that might be relevant is that that LuaJIT can JIT-optimize FFI calls from Lua but can't/doesn't optimise calls into Lua made via C.
I might be able to go digging for the reference (at this point figure it's best to just reply for now, not sure if you'll see this) but I've read that "the approach" recommended to solve this problem is to move the main `for(;;)` / `while(1)` loop into Lua and have LuaJIT repeatedly FFI-call C, because that's the path that can go the fastest.
aka, upon DLL invocation (on Win32 they call it DllMain I guess, I've seen it call ctor/dtor on *nix), spawn the runtime, and expose FFI functions?
http://www.drewtech.com/support/passthru.html
This spec is really big on FFI exposing functions. I always find it an edge case when trying to play with certain technologies (like the one in the article).