FFI
Foreign Function Interface (FFI) is a mechanism that allows code written in one programming language to call routines or use services written in another language. It provides a bridge between languages, handling symbol resolution, data type conversion (marshalling), and calling conventions. FFI can be provided by language runtimes, compilers, or external libraries, and can operate at compile time or at runtime.
Implementation approaches include static bindings generated at compile time or dynamic bindings resolved at runtime. A
FFI is widely used to access system APIs, to reuse performance-critical native libraries, or to interoperate