In computing, a binding from a programming language to a library or operating system service is an application programming interface (API) providing glue code to use that library or service in a given programming language.
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 languages, so that a library written for one language can be used in another language. Many software libraries are written in system programming languages such as C or C++. To use such libraries from another language, usually of higher-level, such as Java, Common Lisp, 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's
ctypes, and Embeddable Common Lisp's
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 software repository. 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 algorithms efficiently in some high-level languages.
- Common Object Request Broker Architecture (CORBA) – cross-platform-language model
- Component Object Model (COM) – Microsoft Windows only cross-language model
- Common Language Infrastructure – .NET Framework cross-platform-language model
- Freedesktop.org D-Bus – open cross-platform-language model
This article is in a list format that may be better presented using prose. (November 2016)
- "Appendix A. Creating a language binding for cairo". Cairographics.org. Retrieved 2014-04-02.
- "Standards, APIs, Interfaces and Bindings". Acm.org. Retrieved 2014-04-02.
- "15.17. ctypes – A foreign function library for Python". Python v2.7.6 documentation. Docs.python.org. Retrieved 2014-04-02.
- Hickey, Jason; Madhavapeddy, Anil; Minsky, Yaron (2013). "Real Worl OCaml, Chapter 19. Foreign Function Interface". realworldocaml.org. Retrieved 2015-07-19.
- "Introduction – CFFI User Manual". Common-lisp.net. Retrieved 2014-04-02.
- "Subversion JavaHL FAQ". Subclipse.tigris.org. 2013-06-18. Retrieved 2014-04-02.
- JTC1/SC22/WG11 - Binding Techniques, an ISO standard for language bindings
- What is a language binding?
|This programming-language-related article is a stub. You can help Wikipedia by expanding it.|