[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT FFI callbacks (was Re: Calling lua functions from C when using luajit ffi.)
- From: "Gerry Weaver" <gerryw@...>
- Date: Mon, 14 Nov 2011 18:06:49 -0600
Simply awesome. I've been waiting for this one. For me, LuaJIT/FFI is the single most important thing that has happened with Lua for a very long time. Thank you very much for sharing the benefits of all of your hard work with us!
> From: "Mike Pall" <email@example.com>
> To: "Lua mailing list" <firstname.lastname@example.org>
> Date: 11/14/11 17:29
> Subject: LuaJIT FFI callbacks (was Re: Calling lua functions from C when using luajit ffi.)
> Dimiter 'malkia' Stanev wrote:
> > Mike just put support for callbacks for x86/x64
> Yep. Attached are two examples using FFI callbacks. You'll need
> LuaJIT git HEAD on x86 or x64 to run these.
> The first example is for Windows that lists all window titles, the
> other is a simple GTK+ demo (tested on Linux). Excuse the length
> of the GTK+ demo, but programming in GTK+ gets rather verbose.
> Docs are here: http://luajit.org/ext_ffi_semantics.html#callback
> tl;dr: Just pass a Lua function to a C function taking a callback
> argument and the FFI will do all the magic in the background.
> The FFI callback feature for x86/x64 has been sponsored by a
> corporate sponsor, who wishes to remain anonymous at this time.
> Ports to other architectures will follow, depending on sponsorship.
> Or if someone wants to grind their teeth at a really challenging
> assembler project for the CPU of your choice. :-)