libffi - a portable foreign function interface library

libffi-3.0.5 was released on April 3, 2008. You can ftp it from sourceware.org:/pub/libffi/libffi-3.0.5.tar.gz.

libffi is free software. It has a very liberal license.

What is libffi?

Compilers for high level languages generate code that follows certain conventions. These conventions are necessary, in part, for separate compilation to work. One such convention is the "calling convention". The "calling convention" is a set of assumptions made by the compiler about where function arguments will be found on entry to a function. A "calling convention" also specifies where the return value for a function is found.

Some programs may not know at the time of compilation what arguments are to be passed to a function. For instance, an interpreter may be told at run-time about the number and types of arguments used to call a given function. Libffi can be used in such programs to provide a bridge from the interpreter program to compiled code.

The libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run-time.

FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The libffi library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above libffi that handles type conversions for values passed between the two languages.

Supported Platforms

Libffi has been ported to many different platforms, although this release was only tested on: Please send additional platform test results to libffi-discuss@sourceware.org.

How to get it

You can download the latest version from sources.redhat.com:/pub/libffi/.

You can also check out the very latest version via anonymous cvs. Here's how:

 cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/libffi login
     (password is ``anoncvs'')
 cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/libffi co libffi
Once you have it checked out, you can update it with cvs update.

You can also view the cvs archive via cvsweb.

Mailing lists

For such a small piece of software, there are plenty of mailing lists available.

To subscribe to the libffi-announce mailing list, enter your e-mail address:


To subscribe to the libffi-discuss mailing list, enter your e-mail address:

Authors and Credits

libffi was originally written by Anthony Green

The developers of the GNU Compiler Collection project have made innumerable valuable contributions. See this ChangeLog files in the source distribution for details.

Some of the ideas behind libffi were inspired by Gianni Mariani's free gencall library for Silicon Graphics machines.

The closure mechanism was designed and implemented by Kresten Krab Thorup.

Major processor architecture ports were contributed by the following developers:

alpha		Richard Henderson
arm		Raffaele Sena
cris		Simon Posnjak, Hans-Peter Nilsson
frv		Anthony Green
ia64		Hans Boehm
m32r		Kazuhiro Inaoka
m68k		Andreas Schwab
mips		Anthony Green, Casey Marshall
mips64		David Daney
pa		Randolph Chung, Dave Anglin, Andreas Tobler
powerpc		Geoffrey Keating, Andreas Tobler, 
			 David Edelsohn, John Hornkvist
powerpc64	Jakub Jelinek
s390		Gerhard Tonn, Ulrich Weigand
sh		Kaz Kojima
sh64		Kaz Kojima
sparc		Anthony Green, Gordon Irlam
x86		Anthony Green, Jon Beniston
x86-64		Bo Thorsen

Jesper Skov and Andrew Haley both did more than their fair share of stepping through the code and tracking down bugs.

Thanks also to Tom Tromey for bug fixes, documentation and configuration help.

Thanks to Jim Blandy, who provided some useful feedback on the libffi interface.

Andreas Tobler has done a tremendous amount of work on the testsuite.

Alex Oliva solved the executable page problem for SElinux.

The list above is almost certainly incomplete and inaccurate. I'm happy to make corrections or additions upon request.

If you have a problem, or have found a bug, please send a note to libffi-discuss@sources.redhat.com or to me directly (green@redhat.com).