GithubHelp home page GithubHelp logo

lua-ffi-bindings's Introduction

Common Headers Ported to LuaJIT FFI.

Donate via Stripe
Donate via Bitcoin

This repo contains luajit-C bindings for lots of common C files and some 3rd party libraries.

Most of them are automatically created by my C preprocessor in Lua project, whose generate.lua file will automatically create the headers from the compiler's include files.

For some files I use a $LUAJIT_LIBPATH environment variable to specify the base of the directory structure where .so files are located.

From there, sometimes I follow malkia's structure of /$ffi.os/$ffi.arch/ to further distinguish .so files.

This is still a manually run and hand-tweaked process, but will hopefully eventually be automated into my #include-in-Lua project.

The original versions of this started from https://github.com/malkia/ufo .

The directory structure is a bit of a mess.

At first everything was just put in root.

Then I started porting C headers and putting them into the c folder, so that luajit code require 'ffi.c.$header' was equivalent to C code #include <$header.h>.
(But, you ask, why only put the builtin C headers in the c folder when the other libraries' headers go in the root folder? Good question.)

Then I started adding my own attempt at STL classes ported to LuaJIT classes in "lua-ffi-bindings/cpp", so that luajit code require 'ffi.cpp.$header' was equivalent to C++ code #include <$header>. ... so far only "vector" exists but I might add more.

A few of my Lua class wrappers all started to exhibit the same pattern for refcounting (lua-opencl) or automatically deleting resources (lua-gl) ... so I decided to put that behavior in one place, here. Maybe I'll put that into its own unique repo soon.

Dependencies

  • LuaJIT
  • lua-ext
  • template-lua
  • preproc-lua optionally if you want to generate new headers. This requires C headers to be present, which is no problem on linux, but for Windows you'll have to have MSVC or MinGW or something installed.

In the future, I'm hoping to incorporate:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.