[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: can alien callbacks receive pointers (and then pass them to C functions)?
- From: Fabio Mascarenhas <mascarenhas@...>
- Date: Mon, 27 Jul 2009 13:11:15 -0300
On Mon, Jul 27, 2009 at 2:17 AM, Phoenix Sol<phoenix@burninglabs.com> 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
end
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