Language binding

From Wikipedia, the free encyclopedia
Jump to: navigation, search

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 particular 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.[1] Many software libraries are written in system programming languages such as C or C++; in order to use these libraries from another (usually higher-level) language such as Java, Common Lisp, Python or Lua, a binding to the library must be created in that language, possibly requiring the recompilation of the language's code depending on the amount of modification necessary.[2] However, most languages offer an interface to foreign functions, such as Python's and OCaml's ctypes, and Embeddable Common Lisp's cffi and uffi.[3][4][5]

For example, Python bindings are used when an already existing C library written for some purpose is to be used from Python. Another example is libsvn, which is written in C and provides an API for accessing Subversion; in order to access Subversion from within Java code, libsvnjavahl can be used, which depends on libsvn being installed and acts as a bridge between the Java programming language and libsvn, thus providing an API that invokes functions from libsvn to do the real work.[6]

Software reuse is a major motivation for creating library bindings, reducing reimplementation of a library in several languages. Another is the impossibility[clarification needed] of implementing certain[which?] algorithms efficiently in high-level languages.

Runtime environment[edit]

Object models[edit]

  • CORBA – Common Object Request Broker Architecture, cross language cross platform object model
  • COM – Microsoft Windows only cross-language Object Model
    • DCOM – Distributed COM, extension making COM able to work in networks
    • XPCOM – Mozilla applications cross-platform Component Object Model
  • Common Language Infrastructure – .NET cross-language cross-platform Object Model
  • D-Bus – open cross language cross platform Object Model

Virtual machines[edit]


Main article: Porting
  • Portable object – cross language cross platform Object Model definition

See also[edit]


  1. ^ "Appendix A. Creating a language binding for cairo". Retrieved 2014-04-02. 
  2. ^ "Standards, APIs, Interfaces and Bindings". Retrieved 2014-04-02. 
  3. ^ "15.17. ctypes — A foreign function library for Python". Python v2.7.6 documentation. Retrieved 2014-04-02. 
  4. ^ Jason Hickey; Anil Madhavapeddy; Yaron Minsky (2013). "Real Worl OCaml, Chapter 19. Foreign Function Interface". Retrieved 2015-07-19. 
  5. ^ "Introduction - CFFI User Manual". Retrieved 2014-04-02. 
  6. ^ "Subversion JavaHL FAQ". 2013-06-18. Retrieved 2014-04-02. 

External links[edit]