aperezdc / lua-eol

Fully automatic Lua↔C bridge using DWARF debug information

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Eöl - Fully automatic Lua↔C bridge using DWARF

Eöl (ELF Object Loader) ris is a fully automatic, run-time, fast foreign function interface for native C libraries. It allows using existing libraries directly from Lua. Eöl uses the DWARF debugging information generated by C compilers.

Eöl is licensed under a MIT-style license, see LICENSE for the full text.

Change of name

Eöl used to be called Eris, but the name was already used for the Eris persistence system for Lua. The change of name was done on 2015-08-01 to avoid module name clashes.

Compatibility

Eöl is tested and compatible with:

  • Lua 5.3.1
  • Lua 5.3.0

Building

Building Eöl requires the following dependencies:

  • A reasonable POSIX-ish operating system. Development is done using GNU/Linux, other systems might work (YMMV).
  • libdwarf, version 20140805 (or newer).
  • libelf, version 0.161 (or newer).
  • Ninja (preferred), or GNU Make.
  • (Optional) GNU readline.

Though GNU Autofoo is not used, care has been taken in following its conventions, so in order to build Eöl the following will work:

./configure
make

Or, using Ninja to do the build (preferred):

./configure
ninja

Once building has finished, it is possible to check that everything is working fine by running the test suite:

./run-tests

Usage

Once built, the eol module can be used from Lua:

-- Find and load the readline library from the standard system directories.
local libreadline = require("eol").load("libreadline")

-- Obtain a handle to the readline() function, which allows calling it.
local readline = libreadline.readline

-- Read a line from standard input using readline() and echo it back.
print(readline("input: "))

For more examples, check the the samples/ subdirectory. Documentation is available under the doc/ subdirectory. Run your favourite Markdown processor on it to read the documentation in HTML.

Examples

Usage examples can be found in the examples/ subdirectory.

Some of the examples use third-party code, which needs to be built from sources. The needed sources are referenced from the repository as Git submodules, and the exact needed version will be fetched automatically. Note that the examples can only be built with Ninja at the moment:

git submodule update --recursive --init
ninja examples

Additional dependencies for the examples:

  • OpenGL ES 2 (libGLESv2 from Mesa will do).
  • GLFW3

About

Fully automatic Lua↔C bridge using DWARF debug information

License:MIT License


Languages

Language:C 56.3%Language:Lua 42.1%Language:PHP 1.0%Language:Makefile 0.5%