lua-users home
lua-l archive

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

>Is this what libffi is for, or am I missing

Pretty much, yes!

Abstracts all the complex guts of calling DLLs/.so files, which gets weirdly complex when you want to pass pointers, allocate objects, use function callbacks and the like.

There’s a really neat Lua binding here:

I’ve been meaning to promote it here for a month or three but kept forgetting. (Thanks to q66 for this library if they read this list!) 

It gives LuaJIT-type ease of writing quick-and-dirty bindings to system libraries that you only want to use in passing, without having to use LuaJIT.. 

I have cffi-lua and libffi compiled into my personal Lua binary “just in case”.

Have used it usefully for one-off Lua utilities where I wanted to make use of libmagic, libusb and some other stuff I have forgotten now. Some compression library, I think.

(Have only ever tried it on Linux x64, where it has worked well for me.)