Next: 3.2 Command Line Options Up: 3.1 Compiling Previous: 3.1.5 Using sdcclib to Contents Index

##
3.1.6 Using ar to Create and Manage Libraries

Support for ar format libraries was introduced in sdcc 2.9.0. Ar is a standard archive managing utility on unices (Linux, Mac OS X, several unix flavors) so it is not included in the sdcc package.
For Windows platform you can find ar utility in GNU binutils package included in several projects: Cygwin at http://www.cygwin.com/, MinGW at http://www.mingw.org/.
Both the GNU and BSD ar format variants are suppurated by asxxxx linkers. Ar doesn't understand the asxxxx object file format, so there is a special version of ranlib distributed with sdcc, called asranlib, which produces the ar symbol lookup table.
To create a library containing asxxxx object files, you should use the following sequence:

ar -Sq <library name>.lib <list of .rel files>

asranlib <library name>.lib