.. index:: librarian, archive

Librarian
=========

The librarian makes it possible to combine multiple object files into
a single library. This is sometimes called an archiver.

.. running:: librarian nlib
.. literalinclude:: gen/LibrarianSignOn.text
   :language: none

The main use-case for a librarian is to build collections of smaller
fragments, which can be anything from support routines to full fledged
applications. Such collection is called a *library*, *static library*
or an *archive*.


Creating a library
------------------

To create a library, simply list all object files (``.o`` extension)
and a single output file (``.a`` extension).

.. code-block:: none

  $ nlib lib41.a obj1.o obj2.o ashfx.o xtoal.o

The created library is typically used as input to the ``lnnut`` linker
by just specifying it on the command line. When linking with a
library, only those section fragments that are actually used are
included in the final output.
