Foreign Function Interface

A ForeignFunctionInterface (FFI) is an interface that allows calling code written in one programming language, from another that is neither a superset nor a subset.

The term comes from CommonLisp; though it's applicable to any such interface. Other language communities don't use the term FFI as much; some languages such as Java have their own term -- Java refers to it as the JavaNativeInterface.

The most common cases are interfaces that allow calling CeeLanguage or CeePlusPlus from a higher-level language.

...with the caveat that the collection of functions that are callable in CeePlusPlus is restricted -- generally things that are callable from C.

There are implementations for many languages to call CeeLanguage and CeePlusPlus in SimplifiedWrapperAndInterfaceGenerator (SWIG).


Implementing an FFI can be done in several ways:

See also "Design Issues for Foreign Function Interfaces", at If we refer to the low-level language as the "host" language and the high-level language as the "guest" language, then these three approaches boil down to ways to bridge the gap between them, as follows.


It seems that many VbClassic programs use "components" written in C.


EditText of this page (last edited November 9, 2014) or FindPage with title or text search