lua-users home
lua-l archive

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

On Sun, Mar 23, 2014 at 01:16:55PM -0700, Mike Nelson wrote:
> On 3/23/2014 6:36 AM, Roberto Ierusalimschy wrote:
> >>A feature I would love to see is a good FFI built in to Lua 5.3--a
> >>real boon to us who use Lua mainly as an extendible language.
> >Unfortunately, there is no way to implement that in ANSI C.
> >
> >-- Roberto
> >
> I should have thought of that. There are some useful libraries out 
> there, but I'm not having luck finding a currently maintained one. Any 
> library writers out there are welcome to prove me wrong (and showcase 
> their libs!)

libffi is the most widely used FFI implementation in open source projects,
AFAIK. It's been regularly maintained and developed for nearly two decades.
Although for awhile it didn't have official releases, and was just
maintained as a component of GCC.

It tends to come installed by default on OS X, Linux, and *BSDs because of
its relationship with GCC. But there's no standard location for the headers
that you can depend on.

Many projects just include a copy of the whole library within their source
tree. For example, Python:

But I've had some success with just including all the various likely
locations in my Makefile, and allowing the user the ability to specify
additional locations in CPPFLAGS and LDFLAGS.

I believe there's at least one Lua binding module for libffi.