In
programming and
software design
Software design is the process of conceptualizing how a software system will work before it is implemented or modified.
Software design also refers to the direct result of the design process the concepts of how the software will work which co ...
, a binding is an
application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API) that provides
glue code specifically made to allow a
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
to use a foreign
library
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
or
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
service (one that is not native to that language).
Characteristics
Binding generally refers to a mapping of one thing to another. In the context of
software libraries, bindings are
wrapper libraries that bridge two
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
s, so that a
library
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
written for one language can be used in another language. Many software libraries are written in
system programming language
A system programming language is a programming language used for system programming; such languages are designed for writing system software, which usually requires different development approaches when compared with application software. Eds ...
s such as
C or
C++. To use such libraries from another language, usually of
higher-level, such as
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
,
Common Lisp
Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ''ANSI INCITS 226-1994 (S2018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperli ...
,
Scheme,
Python, or
Lua, a binding to the library must be created in that language, possibly requiring
recompiling the language's code, depending on the amount of modification needed. However, most languages offer a
foreign function interface, such as Python's and
OCaml
OCaml ( , formerly Objective Caml) is a General-purpose programming language, general-purpose, High-level programming language, high-level, Comparison of multi-paradigm programming languages, multi-paradigm programming language which extends the ...
's
ctypes
, and
Embeddable Common Lisp's
cffi
and
uffi
.
For example,
Python bindings are used when an extant C library, written for some purpose, is to be used from Python. Another example is
libsvn
which is written in C to provide an API to access the
Subversion
Subversion () refers to a process by which the values and principles of a system in place are contradicted or reversed in an attempt to sabotage the established social order and its structures of Power (philosophy), power, authority, tradition, h ...
software repository
A software repository, or repo for short, is a storage location for Package format, software packages. Often a table of contents is also stored, along with metadata. A software repository is typically managed by source or version control, or rep ...
. To access Subversion from within Java code,
libsvnjavahl
can be used, which depends on
libsvn
being installed and acts as a bridge between the language Java and
libsvn
, thus providing an API that invokes functions from
libsvn
to do the work.
Major motives to create library bindings include
software reuse, to reduce reimplementing a library in several languages, and the difficulty of implementing some
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of Rigour#Mathematics, mathematically rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algo ...
s efficiently in some high-level languages.
Runtime environment
Object models
*
Common Object Request Broker Architecture (CORBA) –
cross-platform
Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
-language model
*
Component Object Model
Component Object Model (COM) is a binary-interface technology for software components from Microsoft that enables using objects in a language-neutral way between different programming languages, programming contexts, processes and machines ...
(COM) –
Microsoft Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
only cross-language model
**
Distributed Component Object Model (DCOM) – extension enabling COM to work over networks
** Cross Platform Component Object Model (
XPCOM) – Mozilla applications
cross-platform
Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
model
*
Common Language Infrastructure
The Common Language Infrastructure (CLI) is an open specification and technical standard originally developed by Microsoft and standardized by International Organization for Standardization, ISO/International Electrotechnical Commission, IEC (ISO/ ...
–
.NET Framework cross-platform
Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
-language model
*
Freedesktop.org D-Bus – open
cross-platform
Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
-language model
Virtual machines
*
Comparison of application virtual machines
Porting
*
Portable object –
cross-platform
Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
-language object model definition
See also
*
Application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API)
*
Application binary interface
An application binary interface (ABI) is an interface exposed by software that is defined for in-process machine code access. Often, the exposing software is a library, and the consumer is a program.
An ABI is at a relatively low-level of a ...
(ABI)
*
Calling convention
*
Embedded SQL
*
Name mangling
In compiler construction, name mangling (also called name decoration) is a technique used to solve various problems caused by the need to resolve unique names for programming entities in many modern programming languages.
It provides means to e ...
* Simplified Wrapper and Interface Generator (
SWIG) – interface binding generator from many languages to many languages, open-source
*
Wrapper function
A wrapper function is a function (another word for a ''subroutine'') in a software library or a computer program whose main purpose is to call a second subroutine or a system call with little or no additional computation. Wrapper functions sim ...
References
External links
JTC1/SC22/WG11 - Binding Techniques an ISO standard for language bindings
What is a language binding?
Compilers
Computer libraries
{{compu-lang-stub