Chapter 3
Program Structure
Libraries
A library consists of the following parts:
- A library definition. This specifies a name for the library; a set of modules that are exported from the library for use by other libraries; a set of other libraries that are used by the library being defined; and a set of modules that are imported from the used libraries. To allow separate compilation, library-use relationships may not be circular. A complete description of library definitions is given on page 386.
- The association of source code with the library. The mechanism by which this association is made is controlled by the programming environment and is implementation-defined.
- The association of executable code with the library. The mechanism by which this association is made is implementation-defined. The mechanism by which the compiler is invoked to produce the executable code is implementation-defined.
- The export information of the library. The format of this
information and the mechanism by which it is associated with the library is
implementation-defined. The export information comprises the information required to
process the source code of another library that imports the library.
The library export information is the only part of a Dylan library that is needed to allow some other library to import it. A library that exports some modules does not have any additional declarations providing information to the compiler when it is processing the code that imports those modules. Rather, any such information that is needed is obtained in some implementation-defined way while processing the source code of the exporting library and is retained in the library export information of the exporting library.
Exporting a module from a library makes all of the bindings exported by the module available for import by modules in other libraries.
Importing a module into a library allows the module to be used by modules defined within the library. This gives the library's modules access to the bindings of the module being imported.
Importing a module into a library does not allow source records in the importing library to be contained in the imported module.
Each implementation must provide a library named dylan
that
exports a module named dylan
. That module must export exactly those
bindings documented as being part of the Dylan language, and the values of those bindings
must be as specified by the Dylan language. The dylan
library is permitted to
export additional implementation-defined modules.
Each library contains an implicitly defined module whose name
is dylan-user
. Within this module, all the bindings specified
by the Dylan language are accessible using their specified names. Additional
implementation-dependent bindings may also be accessible from this
module.