<s>
libffi	B-Language
is	O
a	O
foreign	B-Application
function	I-Application
interface	I-Application
library	O
.	O
</s>
<s>
It	O
provides	O
a	O
C	B-Language
programming	I-Language
language	I-Language
interface	O
for	O
calling	O
natively	O
compiled	B-Language
functions	O
given	O
information	O
about	O
the	O
target	O
function	O
at	O
run	B-Library
time	I-Library
instead	O
of	O
compile	B-Application
time	I-Application
.	O
</s>
<s>
It	O
also	O
implements	O
the	O
opposite	O
functionality	O
:	O
libffi	B-Language
can	O
produce	O
a	O
pointer	O
to	O
a	O
function	O
that	O
can	O
accept	O
and	O
decode	O
any	O
combination	O
of	O
arguments	O
defined	O
at	O
run	B-Library
time	I-Library
.	O
</s>
<s>
libffi	B-Language
is	O
most	O
often	O
used	O
as	O
a	O
bridging	O
technology	O
between	O
compiled	B-Language
and	O
interpreted	B-Application
language	I-Application
implementations	O
.	O
</s>
<s>
libffi	B-Language
may	O
also	O
be	O
used	O
to	O
implement	O
plug-ins	B-Application
,	O
where	O
the	O
plug-in	B-Application
'	O
s	O
function	O
signatures	O
are	O
not	O
known	O
at	O
the	O
time	O
of	O
creating	O
the	O
host	O
application	O
.	O
</s>
<s>
Notable	O
users	O
include	O
Python	B-Language
,	O
Haskell	B-Language
,	O
Dalvik	B-Application
,	O
F-Script	B-Language
,	O
PyPy	B-Language
,	O
PyObjC	B-Operating_System
,	O
RubyCocoa	B-Operating_System
,	O
JRuby	B-Language
,	O
Rubinius	B-Application
,	O
MacRuby	B-Operating_System
,	O
gcj	B-Language
,	O
GNU	B-Application
Smalltalk	I-Application
,	O
IcedTea	B-Language
,	O
Cycript	O
,	O
Pawn	O
,	O
Squeak	B-Operating_System
,	O
Java	B-Language
Native	I-Language
Access	I-Language
,	O
Common	B-Language
Lisp	I-Language
(	O
via	O
CFFI	O
)	O
,	O
Racket	B-Operating_System
,	O
Embeddable	B-Language
Common	I-Language
Lisp	I-Language
and	O
Mozilla	B-Operating_System
.	O
</s>
<s>
On	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
,	O
libffi	B-Language
is	O
commonly	O
used	O
with	O
BridgeSupport	O
,	O
which	O
provides	O
programming	O
language	O
neutral	O
descriptions	O
of	O
framework	B-Architecture
interfaces	O
,	O
and	O
Nu	B-Application
which	O
binds	O
direct	O
Objective-C	B-Language
access	O
from	O
Lisp	B-Language
.	O
</s>
<s>
libffi	B-Language
has	O
been	O
widely	O
ported	O
and	O
is	O
released	O
under	O
a	O
MIT	B-License
license	I-License
.	O
</s>
<s>
Although	O
the	O
C	B-Language
programming	I-Language
language	I-Language
is	O
ubiquitous	O
among	O
platforms	O
,	O
the	O
ways	O
function	O
calls	O
are	O
implemented	O
in	O
machine	O
code	O
the	O
calling	O
convention	O
vary	O
.	O
</s>
<s>
libffi	B-Language
has	O
knowledge	O
of	O
the	O
calling	O
convention	O
on	O
many	O
platforms	O
(	O
processorOS	O
combinations	O
)	O
.	O
</s>
<s>
Its	O
C	B-Language
API	B-Application
,	O
which	O
is	O
shared	O
on	O
all	O
builds	O
of	O
libffi	B-Language
regardless	O
of	O
platform	O
,	O
abstracts	B-Application
over	O
the	O
complexity	O
of	O
loading	O
code	O
on	O
different	O
platforms	O
.	O
</s>
<s>
In	O
addition	O
to	O
regular	O
functions	O
,	O
it	O
also	O
supports	O
C-style	O
variadic	B-Language
functions	I-Language
.	O
</s>
<s>
The	O
C	B-Language
calling	O
convention	O
is	O
not	O
only	O
used	O
by	O
the	O
C	B-Language
language	I-Language
:	O
due	O
to	O
the	O
amount	O
of	O
existing	O
code	O
written	O
in	O
C	B-Language
,	O
most	O
newer	O
compiled	B-Language
languages	O
also	O
allow	O
writing	O
and	O
calling	O
functions	O
in	O
such	O
a	O
convention	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
libffi	B-Language
is	O
able	O
to	O
interact	O
with	O
some	O
functions	O
written	O
in	O
these	O
languages	O
too	O
.	O
</s>
<s>
libffi	B-Language
,	O
originally	O
developed	O
by	O
Anthony	O
Green	O
,	O
was	O
inspired	O
by	O
the	O
Gencall	O
library	O
from	O
Silicon	O
Graphics	O
.	O
</s>
<s>
Gencall	O
was	O
developed	O
by	O
Gianni	O
Mariani	O
,	O
then	O
employed	O
by	O
SGI	O
,	O
for	O
the	O
purpose	O
of	O
allowing	O
calls	O
to	O
functions	O
by	O
address	O
and	O
creating	O
a	O
call	O
frame	O
for	O
the	O
particular	O
calling	O
convention	O
(	O
MIPS	B-Device
O32	O
)	O
.	O
</s>
<s>
Anthony	O
Green	O
refined	O
the	O
idea	O
and	O
extended	O
it	O
to	O
other	O
architectures	O
and	O
calling	O
conventions	O
and	O
open	O
sourcing	O
libffi	B-Language
.	O
</s>
<s>
The	O
libffi	B-Language
library	O
is	O
useful	O
in	O
building	O
a	O
bridge	O
between	O
interpreted	B-Application
and	O
natively	O
compiled	B-Language
code	O
.	O
</s>
<s>
Bindings	O
to	O
the	O
libffi	B-Language
library	O
for	O
D	O
.	O
Primarily	O
used	O
for	O
the	O
(	O
Managed	O
Compiler	B-Language
Infrastructure	O
)	O
.	O
</s>
<s>
Dynamically	O
generates	O
Cocoa	O
classes	O
written	O
in	O
F-Script	B-Language
.	O
</s>
<s>
libffi	B-Language
has	O
been	O
used	O
for	O
the	O
majority	O
of	O
the	O
FFI	O
performed	O
by	O
the	O
GHC	B-Application
since	O
late	O
2009	O
.	O
</s>
<s>
The	O
open-source	O
implementation	O
of	O
the	O
Java	O
Platform	O
Standard	O
Edition	O
uses	O
libffi	B-Language
to	O
bridge	O
between	O
the	O
interpreter	B-Application
and	O
native	O
code	O
for	O
Zero-Assembly	O
port	O
.	O
</s>
<s>
Dalvik	B-Application
is	O
the	O
virtual	O
machine	O
which	O
runs	O
the	O
Java	O
platform	O
on	O
Android	B-Application
mobile	I-Application
devices	O
.	O
</s>
<s>
libffi	B-Language
is	O
used	O
on	O
Android	B-Application
ports	O
for	O
which	O
no	O
custom	O
bridging	O
code	O
has	O
been	O
written	O
.	O
</s>
<s>
The	O
runtime	B-Library
library	I-Library
for	O
the	O
GNU	B-Application
Compiler	I-Application
for	O
the	O
Java	O
Programming	O
Language	O
uses	O
libffi	B-Language
to	O
handle	O
calls	O
back	O
and	O
forth	O
between	O
interpreted	B-Application
and	O
natively	O
compiled	B-Language
code	O
.	O
</s>
<s>
gcj	B-Language
is	O
part	O
of	O
the	O
GCC	B-Application
,	O
the	O
GNU	B-Application
Compiler	I-Application
Collection	I-Application
.	O
</s>
<s>
Call	O
Objective-C	B-Language
code	O
from	O
javascript	B-Language
on	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
and	O
the	O
iPhone	O
(	O
via	O
the	O
libffi-iphone	O
port	O
)	O
.	O
</s>
<s>
libffi	B-Language
is	O
used	O
in	O
the	O
js-ctypes	O
library	O
(	O
previously	O
known	O
as	O
ctypes.jsm	O
)	O
to	O
call	O
C	B-Language
functions	O
within	O
JavaScript	B-Language
code	O
(	O
available	O
in	O
XULRunner	B-Language
applications	O
,	O
Firefox	B-Application
extensions	O
etc	O
)	O
.	O
</s>
<s>
A	O
Node.js	B-Language
addon	O
for	O
loading	O
and	O
calling	O
dynamic	O
libraries	O
from	O
JavaScript	B-Language
.	O
</s>
<s>
The	O
standard	O
foreign	B-Application
function	I-Application
interface	I-Application
library	O
for	O
Common	B-Language
Lisp	I-Language
includes	O
the	O
cffi-libffi	O
system	O
to	O
include	O
support	O
for	O
passing	O
and	O
returning	O
structure	O
arguments	O
by	O
value	O
.	O
</s>
<s>
pixie	O
(	O
a	O
Clojure	B-Language
inspired	O
Lisp	B-Language
dialect	O
)	O
uses	O
libffi	B-Language
as	O
the	O
default	O
foreign	B-Application
function	I-Application
interface	I-Application
mechanism	O
.	O
</s>
<s>
A	O
thin	O
wrapper	O
around	O
libffi	B-Language
.	O
</s>
<s>
Newer	O
,	O
more	O
convenient	O
wrapper	O
around	O
libffi	B-Language
.	O
</s>
<s>
The	O
default	O
,	O
most-widely	O
used	O
implementation	O
of	O
the	O
Python	B-Language
programming	I-Language
language	I-Language
uses	O
libffi	B-Language
in	O
the	O
standard	O
ctypes	O
library	O
.	O
</s>
<s>
Call	O
Objective-C	B-Language
code	O
from	O
Python	B-Language
on	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
.	O
</s>
<s>
Call	O
C	B-Language
code	O
from	O
this	O
popular	O
Scheme	O
implementation	O
(	O
also	O
used	O
as	O
the	O
implementation	O
platform	O
for	O
Paul	O
Graham	O
's	O
new	O
Lisp	B-Language
,	O
Arc	O
)	O
.	O
</s>
<s>
A	O
Foreign	B-Application
Function	I-Application
Interface	I-Application
extension	O
for	O
Ruby	O
.	O
</s>
<s>
Call	O
Objective-C	B-Language
code	O
from	O
Ruby	O
on	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
.	O
</s>
