Chapter 5. Libraries and LWAR

LWTOOLS also includes a tool for managing libraries. These are analogous to the static libraries created with the "ar" tool on POSIX systems. Each library file contains one or more object files. The linker will treat the object files within a library as though they had been specified individually on the command line except when resolving external references. External references are looked up first within the object files within the library and then, if not found, the usual lookup based on the order the files are specified on the command line occurs.

The tool for creating these libary files is called LWAR.

5.1. Command Line Options

The binary for LWAR is called "lwar". Note that the binary is in lower case. The options lwar understands are listed below. For archive manipulation options, the first non-option argument is the name of the archive. All other non-option arguments are the names of files to operate on.

--add, -a

This option specifies that an archive is going to have files added to it. If the archive does not already exist, it is created. New files are added to the end of the archive.

--create, -c

This option specifies that an archive is going to be created and have files added to it. If the archive already exists, it is truncated.

--merge, -m

If specified, any files specified to be added to an archive will be checked to see if they are archives themselves. If so, their constituent members are added to the archive. This is useful for avoiding archives containing archives.

--list, -l

This will display a list of the files contained in the archive.

--debug, -d

This option increases the debugging level. It is only useful for LWTOOLS developers.

--help, -?

This provides a listing of command line options and a brief description of each.


This will display a usage summary of each command line option.

--version, -V

This will display the version of LWLINK. of each.