Kalpana Kalpana (Editor)

Libffi

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Developer(s)
  
Anthony Green

Type
  
Runtime library

Written in
  
C, Assembly language

Initial release
  
October 7, 1996; 20 years ago (1996-10-07)

Stable release
  
3.2.1 / November 12, 2014; 2 years ago (2014-11-12)

Operating system
  
Unix-like, Microsoft Windows, OS X, iOS, BareMetal OS

libffi is a foreign function interface library. It provides a C programming language interface for calling natively compiled functions given information about the target function at run time instead of compile time. It also implements the opposite functionality: libffi can produce a pointer to a function that can accept and decode any combination of arguments defined at run time.

Contents

libffi is most often used as a bridging technology between compiled and interpreted language implementations. libffi may also be used to implement plug-ins, where the plug-in's function signatures are not known at the time of creating the host application.

Notable users include Python, Haskell, Dalvik, F-Script, PyPy, PyObjC, RubyCocoa, JRuby, Rubinius, MacRuby, gcj, GNU Smalltalk, IcedTea, Cycript, Pawn, Squeak, Java Native Access, Common Lisp (via CFFI), Racket, Embeddable Common Lisp and Mozilla.

On Mac OS X, libffi is commonly used with BridgeSupport, which provides programming language neutral descriptions of framework interfaces, and Nu which binds direct Objective-C access from Lisp.

libffi has been widely ported and is released under a MIT license.

History

libffi, originally developed by Anthony Green, was inspired by the Gencall library from Silicon Graphics. Gencall was developed by Gianni Mariani, then employed by SGI, for the purpose of allowing calls to functions by address and creating a call frame for the particular calling convention. Anthony Green refined the idea and extended it to other architectures and calling conventions and open sourcing libffi.

Adoption

The libffi library is useful in building a bridge between interpreted and natively compiled code. Some notable users include:

References

Libffi Wikipedia