lua-users home
lua-l archive

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


On Saturday 19, Alex Bradbury wrote:
> On 19 February 2011 06:42, Robert G. Jakabosky <bobby@sharedrealm.com> 
wrote:
> > The ZeroMQ [1] bindings [2] just got faster using LuaJIT2 FFI support.
> > Another important feature of these new bindings is that they still work
> > without FFI support, so the same .so module can be used with the standard
> > Lua VM or with LuaJIT2.  This hybrid module has been created with the
> > help of my LuaNativeObjects [3] bindings generator.  When the module
> > loads and detects FFI support it will replace the normal C bindings with
> > pure Lua code [4] that uses the FFI interface.
> 
> This looks really neat, and thanks for the benchmark.
> 
> One thing I noticed, unless I misread there's no gc hook for the
> FFI-powered version to call zmq_close when the socket is garbage
> collected. I think you need to create a userdata for each socket and
> add a __gc hook there.

Thanks for reminding me about that.  Now the FFI based objects are wrapped in 
a newproxy userdata object.

I plan on making LuaNativeObjects help generate the FFI based bindings, right 
now it only allows you to embed a FFI version of the bindings in the .so file.

-- 
Robert G. Jakabosky