lua-users home
lua-l archive

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


On Thu, Nov 10, 2011 at 12:35 PM, Miles Bader <miles@gnu.org> wrote:
> Jay Carlson <nop@nop.com> writes:
>>> > I don't think it is. Also alien has issues when compiled with MinGW I
>>> > would consider to move to LuaFFI (modeled after luajit2 ffi api) [1].
>>>
>>> LuaFFI isn't portable though; is alien?
>>
>> What do you mean by portable?
>
> What you (probably) think: can be compiled any system that Lua can.
>
>> I thought it was impossible in ANSI C to write Lisp's apply--that is,
>> call an arbitrary function with an arbitrary list of arguments. The
>> signature must be known at compile-time.[1] Now that I think of it,
>> ANSI C has no runtime type information anyway so it is impossible to
>> even describe the argument list.
> No doubt, but thus my question:  what does alien do?  Maybe it isn't
> portable either, or maybe it is portable, but has less functionality
> than LuaFFI.

libffi (on which Alien is based) does a remarkable job of tracking all
those ABI differences for many architectures.

OK, the result isn't as fast as LuaJIT ffi, but often we don't need
particularly fast calls to system operations.

For LuaJIT ffi we of course are all waiting for callback support, but
that's apparently very tricky. Keeping track of closures and ensuring
that they are eventually freed, and so forth.

For C++, well that's a bitch beyond FFI.  When I was last doing this
kind of thing, I had to track a MS compiler and two different GCC
versions, and that was _just_ x86.  (GCC was going through a growth
spurt ;))

steve d.