Tradeoffs, advantages, and disadvantages, Advantages of a library, Disadvantages of a library – Echelon Neuron C User Manual
Page 235

Neuron C Programmer’s Guide
223
The linker only looks at libraries when the object files being linked and combined
with the system image file have not already defined all symbols needed by the
application program. Each library is examined, in the order in which it is
specified in the linker command line. The NodeBuilder Project Make Utility
places the user-defined libraries in order ahead of the standard libraries, thereby
allowing symbols from the standard libraries to be superseded by symbols
defined and exported in the user-defined library. Use this feature with caution
because standard symbols might be accidentally overwritten. When a symbol is
found in a library, the corresponding object file is extracted from the library, and
all objects contained in that object file are added to the link.
An object file in a library can, in turn, introduce other symbols that are
undefined. Such symbols cause the linker to search all the libraries again for
other object files that can resolve these previously undefined symbol references,
and these object files are also be included in the link. The process continues until
all symbols included in the link are resolved, or until the list of libraries is
exhausted.
Tradeoffs, Advantages, and Disadvantages
The use of libraries provides you with certain advantages and disadvantages as
described in the following sections.
Advantages of a Library
Use of a library to contain utility routines and constant data tables can provide
the following advantages:
1
Use of a library can speed up compilation, because utility routines are not
recompiled each time.
2
A library can provide modularity, encapsulation, and reuse — software
engineering techniques which can be used to increase quality and
decrease development costs.
3
The library can contain several related constant tables and procedures.
When organized properly, only the pieces used by a given application are
linked into the application. Unused pieces do not consume any code
space in the device’s application.
4
A library can contain data declarations for objects in any part of a Neuron
Chip’s or Smart Transceiver’s memory space, including near RAM and
EEPROM areas. Libraries also can contain initialized RAM variables.
The initialization rules are identical to Neuron C application programs.
Disadvantages of a Library
Use of a library has the following disadvantages:
1
The NodeBuilder tool offers no way to debug the contents of a library.
However, the contents of data objects in a library can be examined from
the Neuron C debugger, provided that the data is declared as extern in
the application program. Procedures should be fully debugged prior to
placing them in a library.