Quick start manual

Libraries and packages
9-1
Chapter
9
Chapter9
Libraries and packages
A dynamically loadable library is a dynamic-link library (DLL) on Windows or a
shared object library file on Linux. It is a collection of routines that can be called by
applications and by other DLLs or shared objects. Like units, dynamically loadable
libraries contain sharable code or resources. But this type of library is a separately
compiled executable that is linked at runtime to the programs that use it.
To distinguish them from stand-alone executables, on Windows files containing
compiled DLLs are named with the .DLL extension. On Linux, files containing
shared object files are named with a .so extension. Delphi programs can call DLLs or
shared objects written in other languages, and applications written in other
languages can call DLLs or shared objects written in Delphi.
Calling dynamically loadable libraries
You can call operating system routines directly, but they are not linked to your
application until runtime. This means that the library need not be present when you
compile your program. It also means that there is no compile-time validation of
attempts to import a routine.
Before you can call routines defined in a shared object, you must import them. This
can be done in two ways: by declaring an external procedure or function, or by direct
calls to the operating system. Whichever method you use, the routines are not linked
to your application until runtime.
The Delphi language does not support importing of variables from shared libraries.