Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 292
 2012 Microchip Technology Inc.
8.2.2
Using the Librarian
Library files can be built directly using the command-line driver, see 
Section 4.8.44 “--OUTPUT= type: Specify Output File Type”In this case the driver 
will invoke LIBR with the appropriate options saving you from having to use the librar-
ian directly. You may wish to perform this step manually, or you may need to look at the 
contents of library files, for example. This section shows how the librarian can be exe-
cuted from the command-line. The librarian cannot be called from IDEs, such as 
MPLAB IDE.
The librarian program is called LIBR, and the formats of commands to it are as follows:
LIBR [options]  k  file.lpp [file1.p1 file2.p1...]
LIBR [options]  k  file.lib [file1.obj file2.obj ...]
The options are zero or more librarian options which affect the output of the program. 
These are listed in Table 8-1.
A key letter, k, denotes the command requested of the librarian (replacing, extracting 
or deleting modules, listing modules or symbols). These commands are listed in 
Table 8-2.
The first file name listed after the key is the name of the library file to be used. The 
following files, if required, are the modules of the library required by the command 
specified.
If you are building a p-code library, the modules listed must be p-code files. If you are 
building an object file library, the modules listed must be object files.
When replacing or extracting modules, the names of the modules to be replaced or 
extracted must be specified. If no names are supplied, all the modules in the library will 
be replaced or extracted respectively.
Adding a file to a library is performed by requesting the librarian to replace it in the 
library. Since it is not present, the module will be appended to the library. If the r key is 
used and the library does not exist, it will be created.
When using the d key letter, the named modules will be deleted from the library. In this 
instance, it is an error not to give any module names.
The m and s key letters will list the named modules and, in the case of the s key letter, 
the global symbols defined or referenced within. A D or U letter is used to indicate 
whether each symbol is defined in the module, or referenced but undefined. As with the 
r
 and x key letters, an empty list of modules means all the modules in the library.
TABLE 8-1:
LIBRARIAN COMMAND-LINE OPTIONS
Option
 Effect
-P
 width
 Specify page width
-W
 Suppress non-fatal errors
TABLE 8-2:
LIBRARIAN KEY LETTER COMMANDS
Key
 Meaning
r
 Replace modules
d
 Delete modules
x
 Extract modules
m
 List modules
s
 List modules with symbols
o
 Re-order modules