4.6 Archiver Options

The archiver and library maintainer artc is a tool to build library files and it offers the possibility to replace, extract and remove modules from an existing library.

The invocation syntax is:

This section describes all options for the archiver. Some suboptions can only be used in combination with certain key options. They are described together. Suboptions that can always be used are described separately.

The archiver is a command line tool so there are no equivalent options in EDE.

Description Option Suboption
Display an overview of all options -?
Display version information -V
Print object module to standard output -p
Main functions
Delete object module from library -d -v
Move object module to another position -m -a -b - v
Replace or add an object module -r -a -b - c -u -v
Print a table of contents of the library -t -s0 -s1
Extract an object module from the library -x -v

Table 4-1: Overview of archiver options and suboptions

-?

Command line syntax

Description

Displays an overview of all command line options.

Example

The following invocations display a list of the available command line options:

Related information

-

-d

Command line syntax

Description

Delete the specified object modules from a library. With the suboption -v the archiver shows which files are removed.

-v Verbose: the archiver shows which files are removed.

Example

The archiver deletes obj1.o and obj2.o from the library lib.a.

The archiver deletes obj1.o and obj2.o from the library lib.a and displays which files are removed.

Related information

-

-m

Command line syntax

Description

Move the specified object modules to another position in the library.

The ordering of members in a library can make a difference in how programs are linked if a symbol is defined in more than one member.

Default, the specified members are moved to the end of the archive. Use the suboptions -a or -b to move them to a specified place instead.

-a posname Move the specified object module(s) after the existing module posname.

-b posname Move the specified object module(s) before the existing module posname.

Example

Suppose the library lib.a contains the following objects (see option - t):

To move obj1.o to the end of lib.a:

To move obj3.o just before obj2.o:

The library lib.a after these two invocations now looks like:

Related information

Archiver option -t (Print library contents)

-p

Command line syntax

Description

Print the specified object module(s) in the library to standard output.

This option is only useful when you redirect or pipe the output to other files or tools that serve your own purposes. Normally you do not need this option.

Example

The archiver prints the file obj1.o to standard output where it is redirected to the file file.o. The effect of this example is very similar to extracting a file from the library but in this case the 'extracted' file gets another nam.

Related information

-

-r

Command line syntax

Description

You can use the option -r for several purposes:

The option -r normally adds a new module to the library. However, if the library already contains a module with the specified name, the existing module is replaced. If you specify a library that does not exist, the archiver creates a new library with the specified name.

If you add a module to the library without specifying the suboption -a or -b, the specified module is added at the end of the archive. Use the suboptions -a or -b to insert them to a specified place instead.

-a posname Add the specified object module(s) after the existing module posname.

-b posname Add the specified object module(s) before the existing module posname.

-c Create a new library without checking whether it already exists. If the library already exists, it is overwritten.

-u Insert the specified object module only if it is newer than the module in the library.

-v Verbose: the archiver shows which files are removed.

The suboptions -a or -b have no effect when an object is added to the library.

Examples

Suppose the library lib.a contains the following objects (see option -t):

To add obj2.o to the end of lib.a:

To insert obj3.o just before obj2.o:

The library lib.a after these two invocations now looks like:

Creating a new library

To create a new library file, add an object file and specify a library that does not yet exist:

The archiver creates the library newlib.a and adds the object obj1.o to it.

To create a new library file and overwrite an existing library, add an object file and specify an existing library with the supoption - c:

The archiver overwrites the library lib.a and adds the object obj1.o to it. The new library lib.a only contains obj1.o.

Related information

Archiver option -t (Print library contents)

-t

Command line syntax

Description

Print a table of contents of the library to standard out. With the suboption -s you the archiver displays all symbols per object file.

-s0 Displays per object the library in which it resides, the name of the object itself and all symbols in the object.

-s1 Displays only the symbols of all object files in the library.

Example

The archiver prints a list of all object modules in the library lib.a.

The archiver prints per object all symbols in the library. This looks like:

Related information

-

-V

Command line syntax

Description

Display version information. The archiver ignores all other options or input files.

Example

The archiver does not perform any tasks but displays the following version information:

Related information

-

-x

Command line syntax

Description

Extract an existing module from the library.

-o Give the extracted object module the same date as the last-modified date that was recorded in the library.

Without this suboption it receives the last-modified date of the moment it is extracted.

-v Verbose: the archiver shows which files are extracted.

Example

To extract the file obj.o from the library lib.a:

If you do not specify an object module, all object modules are extracted:

Related information

-

-w

Command line syntax

Description

With this suboption you tell the archiver to suppress all warnings above the specified level. The level is a number between 0 - 9.

The level of a message is printed between parentheses after the warning number. If you do not use the -w option, the default warning level is 8.

Example

To suppresses warnings above level 5:

Related information

-


Copyright © 2003 Altium BV