Terminology
Introduction
When discussing Derelict in the
project forums
or elsewhere, it is important to understand the terminology that often surfaces
in such discussions. This will also be helpful in better understanding the Derelict
documentation. Following is a list of terms which could potentially be misunderstood
and their meaning when used in relation to Derelict.
Shared Library
This term is a platform-agnostic way of describing a library which is dynamically
loaded at run time and can be used simultaneously by multiple programs. On Windows,
such libraries are referred to as "Dynamic Link Libraries", or "DLLs", and have
the .dll file extension. On Linux and other Unix-like platforms, such libraries
are referred to as "Shared Object Libraries" or "Shared Objects" and have the
file extension of .so. This also includes the "Frameworks" found on Mac.
When this term is used in relation to Derelict, it can be considered to refer to
any of the above library formats. When you need to refer to a specific
format, you should use the format name instead of the term "Shared Library".
Static Libraries
Static libraries are the traditional form of distribution for archived object
files. On Windows, such libraries are called "Libraries" and have the extension
.lib. On Linux and other Unix-like platforms, such libraries are called "object
archives", "archives", "libraries", and several other terms, all of which have
the file extension .a and usually have the prefix "lib" prepended to the file
name.
Static libraries are compiled into the application at compile time, rather
than being loaded at run time. Because the library is compiled into the executable,
no other executable can share the same compilation.
Import Libraries, or Static Import Libraries
An import library is a library which automates the process of loading a shared
library. On Windows, when you create a DLL most compilers also create a static
library by the same name. This library is the DLL's import library. By compiling
this library into your executable, the application will be bound to the DLL and
the DLL will be loaded at run time by the OS.
Linux and other Unix-like platforms handle this differently. Rather than link
to a separate, static import library, you link to the .so itself. In otherwords,
the .so doubles as a shared library and as an import library. Even though you
are linking to the .so at compile time, the library itself is still loaded at
run time.
Dynamic Linkage
The term "dynamic linkage" usually refers to linking with an import library. As
described above, the import library may be a static library (as on Windows), or
may be the shared library itself (as on Linux).
Static Linkage
The term "static linkage" refers to linking with a static library at compilation
time: .lib on Windows and .a on Linux. Technically speaking, an import library
on Windows must be "statically linked", but the term is normally not applied to
import libraries.
Dynamic Loading
In the context of Derelict, "dynamic loading" refers to the normal method of
loading a shared library at run time: you link with an import library and the
operating system loads the library when the application starts. You, as the
programmer, need do nothing programmatically to load the shared library.
Manual Loading
In the context of Derelict, "manual loading" refers to bypassing the normal
method of loading a shared library at run time: you do not link with an import
library and, instead, load the shared library programmatically through
operating system API calls. This is Derelict's mode of operation and is the
reason why you must call methods like Derelict*.load().