Alternatively, instead of having a .rel file for each entry on the
library file as described in the preceding section, sdcclib can be
used to embed all the modules belonging to such library in the library
file itself. This results in a larger library file, but it greatly
reduces the number of disk files accessed by the linker. Additionally,
the packed library file contains an index of all include modules and
symbols that significantly speeds up the linking process. To display
a list of options supported by sdcclib type:
sdcclib -?
To create a new library file, start by compiling all the required
modules. For example:
sdcc -c _divsint.c
sdcc -c _divuint.c
sdcc -c _modsint.c
sdcc -c _moduint.c
sdcc -c _mulint.c
This will create files _divsint.rel, _divuint.rel, _modsint.rel,
_moduint.rel, and _mulint.rel. The next step is to add the .rel
files to the library file:
sdcclib libint.lib _divsint.rel
sdcclib libint.lib _divuint.rel
sdcclib libint.lib _modsint.rel
sdcclib libint.lib _moduint.rel
sdcclib libint.lib _mulint.rel
Or, if you preffer:
sdcclib libint.lib _divsint.rel _divuint.rel _modsint.rel
_moduint.rel _mulint.rel
If the file already exists in the library, it will be replaced. If
a list of .rel files is available, you can tell sdcclib to add those
files to a library. For example, if the file 'myliblist.txt' contains
_divsint.rel
_divuint.rel
_modsint.rel
_moduint.rel
_mulint.rel
Use
sdcclib -l libint.lib myliblist.txt
Additionally, you can instruct sdcclib to compiles the files before
adding them to the library. This is achieved using the environment
variables SDCCLIB_CC and/or SDCCLIB_AS. For example:
set SDCCLIB_CC=sdcc -c
sdcclib -l libint.lib myliblist.txt
To see what modules and symbols are included in the library, options
-s and -m are available. For example:
sdcclib -s libint.lib
_divsint.rel:
__divsint_a_1_1
__divsint_PARM_2
__divsint
_divuint.rel:
__divuint_a_1_1
__divuint_PARM_2
__divuint_reste_1_1
__divuint_count_1_1
__divuint
_modsint.rel:
__modsint_a_1_1
__modsint_PARM_2
__modsint
_moduint.rel:
__moduint_a_1_1
__moduint_PARM_2
__moduint_count_1_1
__moduint
_mulint.rel:
__mulint_PARM_2
__mulint
If the source files are compiled using --debug, the corresponding debug information file .adb will be include in the library file as well. The library files created with sdcclib are plain text files, so they can be viewed with a text editor. It is not recomended to modify a library file created with sdcclib using a text editor, as there are file indexes numbers located accross the file used by the linker to quickly locate the required module to link. Once a .rel file (as well as a .adb file) is added to a library using sdcclib, it can be safely deleted, since all the information required for linking is embedded in the library file itself. Library files created using sdcclib are used as described in the preceding sections.