GitXplorerGitXplorer
r

mork

public
16 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
8ad39aebcfa55d8717e0c684da68a3f91290e459

README: add a note about using cparser instead

rrrthomas committed 5 years ago
Unverified
4fe21f77acb0146bd96dcbf5db1eef3e2c45ba7d

mork.lua: add library name to generated binding

rrrthomas committed 5 years ago
Unverified
481a35aefb246cff5125ce0c0c3c657d34c6d35b

Update URLs for dependencies (thanks, Tom Lynn).

rrrthomas committed 12 years ago
Unverified
422c361fee1866f42a629a0433cab8e70f671f95

Add more flags to ctypesgen.py call, as needed by new fully

rrrthomas committed 13 years ago
Unverified
acd1c766e6f1e01a23faab08698254afd2a8d9a4

Remove useless standalone script and add method to generate a binding to mork.

rrrthomas committed 14 years ago
Unverified
1b86599e2d145b59f197e1c595a20500f51fd689

Write LuaDoc docstrings.

rrrthomas committed 14 years ago

README

The README file for this repository.
                             mork
                             ----

            (c) Reuben Thomas 2011 <rrt@sc3d.org>
             https://github.com/rrthomas/mork

Mork provides automatic C bindings for Lua using ctypesgen-json and alien. (Mork is a friendly alien. However, it cannot drink through its fingers. Indeed, it does not have fingers. It is a shallow analogy.) Mork is distributed under the MIT License, like Lua itself.

alien is a libffi binding for Lua: http://mascarenhas.github.com/alien/

ctypesgen-json turns C headers into JSON for use with libffi: http://code.google.com/p/ctypesgen/

It might be better to use cparser: http://sourceforge.net/projects/cparser/

Usage

First, turn a header file into JSON using ctypesgen-json:

$ ctypesgen.py --all-headers --builtin-symbols --output-language=json /usr/include/foo.h -o foo.json

Then in Lua, Mork slurps up the JSON and generates alien bindings on the fly, returning a module:

require "mork" require "json"

module = mork.bind (json.decode (io.open ("foo.json"):read ("*a")))