Libraries
Explore how to build and use libraries in D by compiling modules and managing imports. Understand linkage types for integrating external libraries and the role of name mangling in linking.
We'll cover the following...
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 ...