lua-users home
lua-l archive

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


Nice work!  Two questions:

1 - what would sponsorship to another platform cost?  your rate x how
long it takes?
2 - when I run the gtk sample, I get:

luajit: luajit_ffi_gtk_demo.lua:67: cannot convert 'function' to 'int (*)()'
stack traceback:
	[C]: in function 'cast'
	luajit_ffi_gtk_demo.lua:67: in function 'g_signal_connect'
	luajit_ffi_gtk_demo.lua:86: in main chunk
	[C]: ?

I just compiled and ran latest luajit from head?  Am I doing something
wrong? (btw, I have gtk3 on my machine so that may be the reason)

On Mon, Nov 14, 2011 at 5:27 PM, Mike Pall <mikelu-1111@mike.de> wrote:
> 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. :-)
>
> --Mike
>