lua-users home
lua-l archive

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


The first public release of Alien is available (it is 0.3 and not 0.1
because I am counting design iterations :-) ).

# What is Alien

Alien is a Foreign Function Interface (FFI) for Lua. An FFI lets you
call functions in dynamic libraries (.so, .dylib, .dll, etc.) from Lua
code without having to write, compile and link a C binding from the
library to Lua. In other words, it lets you write extensions that call
out to native code using just Lua. It uses Bruno Haible's ffcall
(http://www.haible.de/bruno/packages-ffcall.html) behind the scenes.

Alien is tested on Linux and OSX on wich x86, but should work with
Unix-based systems (the capability to work with Windows is in-place
but still untested).

# Installing Alien

The best way to install Alien is through LuaRocks. Just add
http://www.lua.inf.puc-rio.br/~mascarenhas/rocks to your LuaRocks
configuration, then do "luarocks install alien". You may need root
permissions to do this, depending on your LuaRocks configuration.

In the Alien rock directory you can see a local copy of the
documentation, as well as the test suite. If you are in the path of
the test suite (tests) you can run the suite with:

lua -l luarocks.require test_alien.lua

If everything is ok you should see no output. The test suite is mostly
stolen from Python's ctypes test suite. :-)

Alien installs to modules, alien and alien.struct. The latter is a
slightly modified version of Roberto's struct library that can unpack
binary blobs (userdata) instead of just strings.

# More information

Go to http://alien.luaforge.net for the docs.

I am using Alien to write a wrapper for libevent and non-blocking I/O,
it is not ready yet but has already progressed pretty far, it's the
"aio" rock in the same repository as Alien.

--
Fabio Mascarenhas