Libraries

Let’s discuss libraries in this lesson.

We'll cover the following...

A collection of compiled modules is called a library. Libraries are not programs themselves; they do not have the main() function. Libraries contain compiled definitions of functions, structs, classes, and other features of modules, which are to be linked later by the linker to produce the program.

We can use dmd’s -lib command line option to create libraries. The following command makes a library that contains the “cat.d” and the “dog.d” modules. The name of the library is specified with the -of switch:

$ dmd animal/cat.d animal/dog.d -lib -ofanimal -w -de

The actual name of ...