lua-users home
lua-l archive

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

Oh, now I'm embarrassed, and must apologize for noise...

In my call to alien.callback, my type arguments were not strings  :p
foo_cb = alien.callback(foo, int, pointer)

Duh.  Next time I have a mysterious error, I will try getting some sleep before posting on a mailing list.
I'm sorry for wasting your time  :(

Phoenix Sol

On Mon, Jul 27, 2009 at 11:11 AM, Fabio Mascarenhas <> wrote:
On Mon, Jul 27, 2009 at 2:17 AM, Phoenix Sol<> wrote:
>> Are you using the "pointer" type in both the callback's and the C
>> function's signatures?
> Yes, Fabio. You seem to imply that it should work; perhaps I have overlooked
> something.
> In my callback function, should type(my_pointer_arg) == 'userdata'?

Yep, it should be a light userdata, and is working for me. :-)
Remember that the first type you pass to alien.callback is the return
type, not the type of the first argument:

function foo(ud)
 -- do something with userdata ud
 return 0

foo_cb = alien.callback(foo, "int", "pointer")

> Currently, it is 'number'. I'm certain that it should be receiving a
> pointer.
> Thanks,
> Phoenix Sol

Fabio Mascarenhas