Libraries: Difference between revisions

From Rosetta Code
Content added Content deleted
(Grossly oversimplified description of types of libraries. Someone please correct.)
m (→‎Dynamically-linked Libraries: fix wiki formatting.)
Line 6: Line 6:
On Windows, these files are known as, naturally enough, as '''Dynamically-Linked Libraries''', from which their file extension '''DLL''' is derived.
On Windows, these files are known as, naturally enough, as '''Dynamically-Linked Libraries''', from which their file extension '''DLL''' is derived.


On UNIX-derived systems, these files are known as '''Shared Objects'', from which their file extension '''so''' is derived.
On UNIX-derived systems, these files are known as '''Shared Objects''', from which their file extension '''so''' is derived.


==Implicit vs Explicit linking==
==Implicit vs Explicit linking==

Revision as of 03:58, 31 January 2008

Libraries are software which extend the functionality of a programming language, usually by providing an API to complete a specific task. Different languages may have their own name for libraries, such as Perl modules, or Java packages. They also may also be implemented in different ways.

Dynamically-linked Libraries

Dynamically-linked libraries are libraries that are contained in a file separate from an application's primary executable, and are loaded at run-time. This has the benefit of allowing multiple programs use of the same code both on disk and in memory, saving space. It also allows a program to load additional, optional or interchangeable portions of itself into memory at runtime.

On Windows, these files are known as, naturally enough, as Dynamically-Linked Libraries, from which their file extension DLL is derived.

On UNIX-derived systems, these files are known as Shared Objects, from which their file extension so is derived.

Implicit vs Explicit linking

In implicit linking, an operating system sees that a program will require the use of a library, and loads it automatically. In explicit linking, the running program asks the operating system to load the library.

Statically-linked Libraries

Statically-linked libraries are combined with a program's code at compile-time, their code and the program's code combined to form a single executable.

See also