Content deleted Content added
m distrubuted→distributed - typos.toolforge.org |
Peter Flass (talk | contribs) introduce API |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 5:
[[Image:Ogg vorbis libs and application dia.svg|thumb|277px|right|Illustration of an application which uses libvorbisfile to play an [[Ogg Vorbis]] file]]
In [[computing]], a '''library''' is a collection of [[System resource|resources]] that can be
A library can be used by multiple, independent consumers (programs and other libraries). This differs from resources defined in a program which can usually only be used by that program. When a consumer uses a library resource, it gains the value of the library without having to implement it itself. Libraries encourage [[software reuse]] in a [[Modular programming|modular]] fashion. Libraries can use other libraries resulting in a hierarchy of libraries in a program.
When writing code that uses a library, a [[programmer]] only needs to know how to use it, its [[application programming interface]] (API) {{endash}} not its internal details. For example, a program could use a library that [[Abstraction (computer science)|abstracts]] a complicated [[system call]] so that the programmer can use the system feature without spending time to learn the intricacies of the system function.
== History ==
Line 17:
[[File:FirstCodeLibrary-ESDAC-ThePreparationOfProgramsForAnElectronicDigitalComputer-1951.jpg|thumb|A woman working next to a filing cabinet containing the subroutine library on reels of punched tape for the EDSAC computer.]]
In 1947 [[Herman Goldstine|Goldstine]] and [[John von Neumann|von Neumann]] speculated that it would be useful to create a "library" of [[subroutine]]s for their work on the [[IAS machine]], an early computer that was not yet operational at that time.<ref>{{Cite book |last=Goldstine |first=Herman H. |url=http://dx.doi.org/10.1515/9781400820139 |title=The Computer from Pascal to von Neumann |date=2008-12-31 |publisher=Princeton University Press |isbn=978-1-4008-2013-9 |___location=Princeton |doi=10.1515/9781400820139}}</ref> They envisioned a physical library of [[magnetic wire recording]]s, with each wire storing reusable computer code.<ref>{{cite report |title=Planning and coding of problems for an electronic computing instrument |last1=Goldstine |first1=Herman |author-link1=Herman Goldstine |last2=von Neumann |first2=John
Inspired by von Neumann, [[Maurice Wilkes|Wilkes]] and his team constructed [[EDSAC]]. A [[filing cabinet]] of [[punched tape]] held the subroutine library for this computer.<ref>{{Cite conference|last=Wilkes|first=M. V.| title=1951 International Workshop on Managing Requirements Knowledge |date=1951|chapter=The EDSAC Computer| page=79 |chapter-url=http://dx.doi.org/10.1109/afips.1951.13|conference=1951 International Workshop on Managing Requirements Knowledge|publisher=IEEE|doi=10.1109/afips.1951.13}}</ref> Programs for EDSAC consisted of a main program and a sequence of subroutines copied from the subroutine library.<ref>{{cite journal |last1=Campbell-Kelly |first1=Martin |date=September 2011 |title=In Praise of 'Wilkes, Wheeler, and Gill' |url=https://cacm.acm.org/magazines/2011/9/122802-in-praise-of-wilkes-wheeler-and-gill/fulltext |journal=Communications of the ACM |volume=54 |issue=9 |pages=25–27 |doi=10.1145/1995376.1995386|s2cid=20261972 |url-access=subscription }}</ref> In 1951 the team published the first textbook on programming, ''[[The Preparation of Programs for an Electronic Digital Computer]]'', which detailed the creation and the purpose of the library.<ref>{{cite book |last1=Wilkes |first1=Maurice |last2=Wheeler |first2=David |last3=Gill |first3=Stanley |author-link1=Maurice Wilkes |author-link2=David Wheeler (computer scientist) |author-link3=Stanley Gill |date=1951 |title=The Preparation of Programs for an Electronic Digital Computer |oclc=641145988 |url=https://archive.org/details/programsforelect00wilk/page/80/mode/2up?q=library |___location= |publisher=Addison-Wesley |pages=45, 80–91, 100 |isbn=}}</ref>
Line 51:
A variant is a library containing compiled code (object code in IBM's nomenclature) in a form that cannot be loaded by the OS but that can be read by the linker.
=== Static ===
A [[static library]] is an executable library that is linked into a program at build-time by a linker (or whatever the build tool is called that does linking).<ref name="Static Libraries">{{cite web|title=Static Libraries|url=http://tldp.org/HOWTO/Program-Library-HOWTO/static-libraries.html|publisher=TLDP|access-date=3 October 2013|url-status=live|archive-url=https://web.archive.org/web/20130703011904/http://tldp.org/HOWTO/Program-Library-HOWTO/static-libraries.html|archive-date=3 July 2013}}</ref><ref>{{cite book|last=Kaminsky|first=Dan|chapter=Chapter 3 - Portable Executable and Executable and Linking Formats|date=2008|chapter-url=http://dx.doi.org/10.1016/b978-1-59749-237-9.00003-x|title=Reverse Engineering Code with IDA Pro|pages=37–66|publisher=Elsevier|doi=10.1016/b978-1-59749-237-9.00003-x|isbn=978-1-59749-237-9|access-date=2021-05-27}}</ref> This process, and the resulting stand-alone file, is known as a [[static build]] of the program. A static build may not need any further [[relocation (computer science)|relocation]] if [[virtual memory]] is used and no [[address space layout randomization]] is desired.<ref>{{cite conference|url=http://usenix.org/legacy/publications/library/proceedings/usenix05/tech/general/full_papers/collberg/collberg_html/main.html|title=SLINKY: Static Linking Reloaded|conference=USENIX '05|first1=Christian |last1=Collberg |first2=John H. |last2=Hartman |first3=Sridivya |last3=Babu |first4=Sharath K. |last4=Udupa|publisher=Department of Computer Science, [[University of Arizona]]|access-date=2016-03-17|year=2003|url-status=live|archive-url=https://web.archive.org/web/20160323214637/https://www.usenix.org/legacy/publications/library/proceedings/usenix05/tech/general/full_papers/collberg/collberg_html/main.html|archive-date=23 March 2016}}</ref>
A static library is sometimes called an ''archive'' on Unix-like systems.
=== Dynamic ===
A [[dynamic library]] is linked when the program is run {{endash}} either at [[load-time]] or [[Runtime (program lifecycle phase)|runtime]]. The dynamic library was intended after the static library to support additional [[software deployment]] flexibility.
=== Sources ===
A source library consists of source code; not compiled code.
=== Shared ===
A [[shared library]] is a library that contains [[executable code]] designed to be used by multiple [[computer program]]s or other libraries at [[Runtime (program lifecycle phase)|runtime]], with only one copy of that code in memory, shared by all programs using the code.<ref>{{cite book |title=Linkers and Loaders |last=Levine |first=John R. |chapter=9. Shared Libraries |isbn=1-55860-496-0 |date=2000}}</ref><ref>{{cite book |title=UNIX System V/386 Release 3.2 Programmers Guide, Vol. 1 |url=http://www.bitsavers.org/pdf/att/unix/System_V_386_Release_3.2/UNIX_System_V_386_Release_3.2_Programmers_Guide_Vol1_1989.pdf |page=8{{hyp}}2 |isbn=0-13-944877-2 |date=1989|publisher=Prentice Hall }}</ref><ref>{{cite web |url=https://www.cs.cornell.edu/courses/cs414/2001FA/sharedlib.pdf |title=Shared Libraries in SunOS |pages=1, 3}}</ref>
=== Object ===
Although generally an obsolete technology today, an object library exposes resources for [[object-oriented programming]] (OOP) and a distributed object is a remote object library. Examples include: [[Component Object Model|COM]]/DCOM, [[System Object Model|SOM]]/DSOM, [[Distributed Objects Everywhere|DOE]], [[Portable Distributed Objects|PDO]] and various [[CORBA]]-based systems.
Line 74:
The remote object technology was developed in parallel to support multi-tier programs with a [[user interface]] application running on a [[personal computer]] (PC) using services of a [[Mainframe computer|mainframe]] or [[minicomputer]] such as data storage and processing. For instance, a program on a PC would send messages to a minicomputer via [[remote procedure call]] (RPC) to retrieve relatively small samples from a relatively large dataset. In response, distributed object technology was developed.
=== Class ===
A class library contains [[Class (computer science)|classes]] that can be used to create [[object (computer science)|objects]]. In [[Java (programming language)|Java]], for example, classes are contained in [[jar (file format)|JAR files]] and objects are created at runtime from the classes. However, in [[Smalltalk]], a class library is the starting point for a [[system image]] that includes the entire state of the environment, classes and all instantiated objects. Most class libraries are stored in a [[package repository]] (such as Maven Central for Java). Client code explicitly specifies dependencies to external libraries in build configuration files (such as a Maven Pom in Java).
=== Remote ===
A remote library runs on another computer and its assets are accessed via [[remote procedure call]] (RPC) over a network. This [[Distributed computing|distributed architecture]] allows for minimizing installation of the library and support for it on each consuming system and ensuring consistent versioning. A significant downside is that each library call entails significantly more overhead than for a local library.
Line 87:
Many modern [[programming languages]] specify a [[standard library]] that provides a base level of functionality for the language environment.
=== Code generation ===
A code generation library has a high-level [[Application Programming Interface|API]] generating or transforming [[byte code]] for [[Java (programming language)|Java]]. They are used by [[aspect-oriented programming]], some data access frameworks, and for testing to generate dynamic proxy objects. They also are used to intercept field access.<ref>{{cite web
|access-date = 2010-03-03
Line 161:
* {{cite book |author-last=Levine |author-first=John R. |author-link=John R. Levine |title=Linkers and Loaders |date=2000 |orig-year=October 1999 |edition=1 |publisher=[[Morgan Kaufmann]] |series=The Morgan Kaufmann Series in Software Engineering and Programming |___location=San Francisco, USA |isbn=1-55860-496-0 |oclc=42413382 |chapter=Chapter 9: Shared Libraries & Chapter 10: Dynamic Linking and Loading |url=https://www.iecc.com/linker/ |access-date=2020-01-12 |url-status=live |archive-url=https://archive.today/20121205032107/http://www.iecc.com/linker/ |archive-date=2012-12-05}} Code: [https://archive.today/20200114225034/https://linker.iecc.com/code.html][ftp://ftp.iecc.com/pub/linker/]{{dead link|date=May 2025|bot=medic}}{{cbignore|bot=medic}} Errata: [https://linker.iecc.com/<!-- https://archive.today/20200114224817/https://linker.iecc.com/ 2020-01-14 -->]
* Article ''[http://www.lurklurk.org/linkers/linkers.html Beginner's Guide to Linkers]'' by David Drysdale
* Article ''[
* {{usurped|1=[https://web.archive.org/web/20060628062553/http://www.enderunix.org/simsek/articles/libraries.pdf How to Create Program Libraries]}} by Baris Simsek
* [https://sourceware.org/binutils/docs-2.30/bfd/index.html BFD] - the Binary File Descriptor Library
|