Shared library

A shared library or shared object is a computer file that contains executable code designed to be used by multiple computer programs or other libraries at runtime.

When running a program that is configured to use a shared library, the operating system loads the shared library from a file (other than the program's executable file) into memory at load time or runtime. For perspective, a program can alternatively be monolithic—built to include the executable code of the library in its executable file, but the library code embedded in the program's executable file is not usable by other programs.

Shared libraries can be statically linked at compile-time, meaning that references to the library are resolved and the library is allocated memory when the executable file is created.[citation needed] But often linking of shared libraries is postponed until they are loaded.[dubiousdiscuss]

Most modern operating systems use the same format for both shared libraries and executable files.[NB 1] This offers two main advantages: first, it requires only one loader (building and maintaining a single loader is considered well worth any added complexity).[citation needed] Secondly, it allows an executable file to be used as a shared library (if it has a symbol table). Examples of file formats use for both shared libraries and executable files include ELF, Mach-O, and PE.

In some older environments such as 16-bit Windows or MPE for the HP 3000, only stack-based data (local) was allowed in shared library code, or other significant restrictions were placed on shared library code.

Memory sharing

Library code may be shared in memory by multiple processes, and on disk. If virtual memory is used, processes would execute the same physical page of RAM that is mapped into the different address spaces of the processes. This has advantages. For instance, on the OpenStep system, applications were often only a few hundred kilobytes in size and loaded quickly; most of their code was located in libraries that had already been loaded for other purposes by the operating system.[citation needed]

Programs can accomplish RAM sharing by using position-independent code, as in Unix, which leads to a complex but flexible architecture, or by using common virtual addresses, as in Windows and OS/2. These systems ensure, by various means, like pre-mapping the address space and reserving slots for each shared library, that code has a high probability of being shared. A third alternative is single-level store, as used by the IBM System/38 and its successors. This allows position-dependent code, but places no significant restrictions on where code can be placed or how it can be shared.

In some cases, different versions of shared libraries can cause problems, especially when libraries of different versions have the same file name, and different applications installed on a system each require a specific version. Such a scenario is known as DLL hell, named after the Windows and OS/2 DLL file. Most modern operating systems after 2001 have clean-up methods to eliminate such situations or use application-specific "private" libraries.[1]

Dynamic linking

Dynamic linking or late binding is linking performed while a program is being loaded (load time) or executed (runtime), rather than when the executable file is created. A dynamically linked library (dynamic-link library, or DLL, under Windows and OS/2; shareable image under OpenVMS;[2] dynamic shared object, or DSO, under Unix-like systems) is a library intended for dynamic linking. Only a minimal amount of work is done by the linker when the executable file is created; it only records what library routines the program needs and the index names or numbers of the routines in the library. The majority of the work of linking is done at the time the application is loaded (load time) or during execution (runtime). Usually, the necessary linking program, called a dynamic linker or linking loader, is actually part of the underlying operating system. (However, it is possible, and not exceedingly difficult, to write a program that uses dynamic linking and includes its own dynamic linker, even for an operating system that itself provides no support for dynamic linking.)

Programmers originally developed dynamic linking in the Multics operating system, starting in 1964, and the MTS (Michigan Terminal System), built in the late 1960s.[3]

Optimizations

Since shared libraries on most systems do not change often, systems can compute a likely load address for each shared library on the system before it is needed and store that information in the libraries and executables. If every shared library that is loaded has undergone this process, then each will load at its predetermined address, which speeds up the process of dynamic linking. This optimization is known as prebinding or prelinking on macOS and Linux, respectively. IBM z/VM uses a similar technique, called "Discontinuous Saved Segments" (DCSS).[4] Disadvantages of this technique include the time required to precompute these addresses every time the shared libraries change, the inability to use address space layout randomization, and the requirement of sufficient virtual address space for use (a problem that will be alleviated by the adoption of 64-bit architectures, at least for the time being).

Locating libraries at runtime

Loaders for shared libraries vary widely in functionality. Some depend on the executable storing explicit paths to the libraries. Any change to the library naming or layout of the file system will cause these systems to fail. More commonly, only the name of the library (and not the path) is stored in the executable, with the operating system supplying a method to find the library on disk, based on some algorithm.

If a shared library that an executable depends on is deleted, moved, or renamed, or if an incompatible version of the library is copied to a place that is earlier in the search, the executable would fail to load. This is called dependency hell, existing on many platforms. The (infamous) Windows variant is commonly known as DLL hell. This problem cannot occur if each version of each library is uniquely identified and each program references libraries only by their full unique identifiers. The "DLL hell" problems with earlier Windows versions arose from using only the names of libraries, which were not guaranteed to be unique, to resolve dynamic links in programs. (To avoid "DLL hell", later versions of Windows rely largely on options for programs to install private DLLs—essentially a partial retreat from the use of shared libraries—along with mechanisms to prevent replacement of shared system DLLs with earlier versions of them.)

Microsoft Windows

Microsoft Windows checks the registry to determine the proper place to load DLLs that implement COM objects, but for other DLLs it will check the directories in a defined order. First, Windows checks the directory where it loaded the program (private DLL[1]); any directories set by calling the SetDllDirectory() function; the System32, System, and Windows directories; then the current working directory; and finally the directories specified by the PATH environment variable.[5] Applications written for the .NET Framework (since 2002), also check the Global Assembly Cache as the primary store of shared dll files to remove the issue of DLL hell.

OpenStep

OpenStep used a more flexible system, collecting a list of libraries from a number of known locations (similar to the PATH concept) when the system first starts. Moving libraries around causes no problems at all, although users incur a time cost when first starting the system.

Unix-like systems

Most Unix-like systems have a "search path" specifying file-system directories in which to look for dynamic libraries. Some systems specify the default path in a configuration file, others hard-code it into the dynamic loader. Some executable file formats can specify additional directories in which to search for libraries for a particular program. This can usually be overridden with an environment variable, although it is disabled for setuid and setgid programs, so that a user can't force such a program to run arbitrary code with root permissions. Developers of libraries are encouraged to place their dynamic libraries in places in the default search path. On the downside, this can make installation of new libraries problematic, and these "known" locations quickly become home to an increasing number of library files, making management more complex.

Dynamic loading

Dynamic loading, a subset of dynamic linking, involves a dynamically linked library loading and unloading at runtime on request. Such a request may be made implicitly or explicitly. Implicit requests are made when a compiler or static linker adds library references that include file paths or simply file names.[citation needed] Explicit requests are made when applications make direct calls to an operating system's API.

Most operating systems that support dynamically linked libraries also support dynamically loading such libraries via a run-time linker API. For instance, Microsoft Windows uses the API functions LoadLibrary, LoadLibraryEx, FreeLibrary and GetProcAddress with Microsoft Dynamic Link Libraries; POSIX-based systems, including most UNIX and UNIX-like systems, use dlopen, dlclose and dlsym. Some development systems automate this process.

Notes

  1. ^ Some older systems, e.g., Burroughs MCP, Multics, also have a single format

Further reading

References

  1. ^ a b Anderson, Rick (2000-01-11). "The End of DLL Hell". microsoft.com. Archived from the original on 2001-06-05. Retrieved 2012-01-15. Private DLLs are DLLs that are installed with a specific application and used only by that application.
  2. ^ "VSI OpenVMS Linker Utility Manual" (PDF). VSI. August 2019. Retrieved 2021-01-31.
  3. ^ "A History of MTS". Information Technology Digest. 5 (5).
  4. ^ IBM Corporation (2011). Saved Segments Planning and Administration (PDF). Retrieved Jan 29, 2022.
  5. ^ "Dynamic-Link Library Search Order". Microsoft Developer Network Library. Microsoft. 2012-03-06. Archived from the original on 9 May 2012. Retrieved 2012-05-20.

Read other articles:

يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. (ديسمبر 2018) 2° خط طول 2 غرب خريطة لجميع الإحداثيات من جوجل خريطة لجميع الإحداثيات من بينغ تصدير جميع الإحداثيات من كيه...

 

The Diccionario enciclopédico hispano-americano de literatura, ciencias y artes (1887–99) was a Spanish language general encyclopedia produced by Montaner y Simón in Barcelona, Spain.[1] References ^ Alice Bertha Kroeger; Isadore Gilbert Mudge (1917). Encyclopedias: Spanish. Guide to the Study and Use of Reference Books (3rd ed.). Chicago: American Library Association. Further reading David Prieto García-Seco (2010). Las autoridades del Diccionario enciclopédico hispano-ame...

 

SCP2 Наявні структури PDBПошук ортологів: PDBe RCSB Список кодів PDB 1QND, 2C0L Ідентифікатори Символи SCP2, NLTP, NSL-TP, SCP-2, SCP-CHI, SCP-X, SCPX, sterol carrier protein 2, SCOX Зовнішні ІД OMIM: 184755 MGI: 98254 HomoloGene: 37717 GeneCards: SCP2 Онтологія гена Молекулярна функція • transferase activity• phosphatidylinositol transfer activity• fatty-acyl-CoA binding• acyltransfe...

Siberia beralih ke halaman ini. Untuk kegunaan lain, lihat Siberia (disambiguasi).Siberia Rusia: Сибирь (Sibir')Geografi wilayah       Distrik Federal Siberia        Geografi Siberia Rusia        Wilayah Asia Utara, NegaraRusiaWilayahAsia Utara, EurasiaPartaiDataran Siberia BaratDataran Tinggi Siberia Tengahlainnya... 'Luas • Total13.100.000 km2 (5,100,000 sq...

 

У Вікіпедії є статті про інші значення цього терміна: Зелена книга (значення). Зелена книгаангл. Green Book Офіційний український постер до фільмуЖанр драмедія, біографічнийРежисер Пітер ФаррелліПродюсери Джим БеркБраян Гейєс КарріПітер Фарреллі та ін.Сценарист Нік Валлел

 

Hayes Hayes (Frankreich) Staat Frankreich Region Grand Est Département (Nr.) Moselle (57) Arrondissement Metz Kanton Le Pays messin Gemeindeverband Haut Chemin-Pays de Pange Koordinaten 49° 10′ N, 6° 22′ O49.1666666666676.3661111111111Koordinaten: 49° 10′ N, 6° 22′ O Höhe 207–307 m Fläche 11,99 km² Einwohner 251 (1. Januar 2020) Bevölkerungsdichte 21 Einw./km² Postleitzahl 57530 INSEE-Code 57307 Vorlage:Infobox Gemeind...

У этого термина существуют и другие значения, см. Бандино. ДеревняБандино 55°55′55″ с. ш. 42°51′40″ в. д.HGЯO Страна  Россия Субъект Федерации Нижегородская область Муниципальный район Павловский Сельское поселение Варежский сельсовет История и география Часово...

 

Volute krater discovered in Greece Derveni KraterInv. B1, Archaeological Museum of Thessaloniki. Detail shown below.MaterialBronze with 15% tinHeight90.5 centimetres (35.6 in)Weight40 kilograms (88 lb)WritingFunerary inscription in the Thessalian dialect of ancient GreekCreated4th century BCDiscovered1962Derveni40°43′13″N 22°58′17.2″E / 40.72028°N 22.971444°E / 40.72028; 22.971444 The Derveni Krater is a volute krater,[1] the most ela...

 

Jean Guéguen (* 1. April 1924 in Paris; †  9. Mai 1998 in Saint-Jean-d’Aulps) war ein französischer Radrennfahrer und nationaler Meister im Radsport. Sportliche Laufbahn Als Amateur wurde er 1945 nationaler Meister im Straßenrennen. 1943 hatte er das Eintagesrennen Paris–Briare gewonnen. 1946 wurde er Berufsfahrer und blieb bis 1956 aktiv. 1948 gewann er drei Etappen der Portugal-Rundfahrt. 1951 konnte er das Rennen Paris–Brüssel vor Bernard Gauthier sowie den Circuit de la H...

Expansion to the video game The Elder Scrolls IV: Oblivion 2006 video gameThe Elder Scrolls IV:Knights of the NineDeveloper(s)Bethesda Game StudiosPublisher(s)Bethesda SoftworksEU: UbisoftSeriesThe Elder ScrollsEngineGamebryoPlatform(s)Microsoft WindowsXbox 360PlayStation 3ReleaseWindows, Xbox 360NA: November 21, 2006AU: November 23, 2006EU: November 24, 2006PlayStation 3NA: March 20, 2007AU: April 26, 2007EU: April 27, 2007Genre(s)Action role-playingMode(s)Single-player The Elder Scrolls IV:...

 

10

  关于塔罗牌,请见「10 (塔罗牌)」。 10 ← 9 10 11 → 数表 — 整数 <<  10 11 12 13 14 15 16 17 18 19 >> <<  0 10 20 30 40 50 60 70 80 90 >> <<   100‍  101‍  102‍  103‍  104‍  105‍  106‍  107‍  108‍  109‍ >> 10 · ...

 

Mystic Ballet – Mystic Dark Room Theatre at 325 Mistuxet Ave. Stonington CT. Mystic Ballet is a modern dance company based in Mystic, Connecticut, founded in 1997 by Goran Subotic. History Mystic Ballet began in 1997 as a small group of students. In the years since then, the company has engaged close to 450 affiliates, including 185 performing artists from close to 40 different countries.[citation needed] With support from the National Endowment of the Arts, Connecticut Office of th...

يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. (ديسمبر 2018) الدوري السعودي الممتاز تفاصيل الموسم 1985–1986 النسخة 10  البلد السعودية  البطل الهلال (رابع لقب) الهابط...

 

English actress, writer, journalist, suffragist and feminist Cicely HamiltonCicely Hamilton, c. 1907BornCicely Mary Hammill15 June 1872Paddington, London, EnglandDied6 December 1952 (1952-12-07) (aged 80)Occupation(s)Actor, playwright, novelistKnown forSuffragette, event organiser Cicely Mary Hamilton (née Hammill; 15 June 1872 – 6 December 1952), was an English actress, writer, journalist, suffragist and feminist, part of the struggle for women's suffrage in the United King...

 

Island in Panama Carenero IslandNative name: Isla CareneroBocas del Toro ArchipelagoGeographyCoordinates9°21′N 82°14′W / 9.350°N 82.233°W / 9.350; -82.233ArchipelagoBocas del Toro ArchipelagoArea0.94 km2 (0.36 sq mi)Highest elevation0 m (0 ft)AdministrationPanamaProvinceBocas del ToroDistrictBocas del ToroCorregimientoBocas del ToroDemographicsPopulation737 (2000) Carenero Island (in Spanish: Isla Carenero) is a long and forested i...

1985 novel by Haruki Murakami Hard-Boiled Wonderland and the End of the World Cover of the first Japanese editionAuthorHaruki MurakamiOriginal title世界の終りとハードボイルド・ワンダーランドSekai no Owari to Hādo-Boirudo WandārandoTranslatorAlfred BirnbaumCountryJapanLanguageJapaneseGenreSpeculative fictionScience fictionSurrealismPublisherShinchosha (JP)Kodansha International (US)Publication dateJune 1985Published in EnglishSeptember 1991Media typePrint ...

 

United States historic placeCopake Memorial ClockU.S. National Register of Historic Places Copake Memorial Clock, October 2010Show map of New YorkShow map of the United StatesLocationMain St., Copake, New YorkCoordinates42°06′13″N 73°32′58″W / 42.10361°N 73.54944°W / 42.10361; -73.54944Area0.02 acres (0.0081 ha)Built1944 (1944)NRHP reference No.11001089[1]Added to NRHPFebruary 3, 2012 Copake Memorial Clock, also known as the Copa...

 

All or almost all rivers in Europe have alternative names in different languages. Some rivers have also undergone name changes for political or other reasons. This article provides known alternative names for all major European rivers. It also includes alternative names of some lesser rivers that are important because of their location or history. This article does not offer any opinion about what the original, official, real, or correct name of any river is or was. Rivers are listed alphabet...

2020 studio album by R.A. the Rugged ManAll My Heroes Are DeadStudio album by R.A. the Rugged ManReleasedApril 17, 2020Recorded2017–2020StudioNo Mystery Studio, New York CityGenreHip hopLength75:51LabelNature SoundsProducerPrince Paul, DJ Jazzy Jeff, Psycho Les, Mr. Green, Classified, Teddy Roxspin, C-Lance, Shroom,[1] The JokerrR.A. the Rugged Man chronology Legends Never Die(2013) All My Heroes Are Dead(2020) Unknown(Unknown) Singles from All My Heroes Are Dead Legendary L...

 

Глава Чеченской Республикичечен. Мехк-Да Штандарт главы Чеченской Республики Должность занимает Рамзан Ахматович Кадыров(врио 15 февраля — 5 апреля 2007) с 5 апреля 2007 года(врио 25 марта — 5 октября 2016) Должность Возглавляет Чеченскую Республику Резиденция Резиденция Главы ...

 

Strategi Solo vs Squad di Free Fire: Cara Menang Mudah!