DLL Programmer's Guide for TNS/R Systems
Advanced DLL Facility Controls
DLL Programmer’s Guide for TNS/R Systems—522203-002
5-4
Making the Linker Look for Unresolved Symbols
Making the Linker Look for Unresolved
Symbols
As part of a link, you can ask the linker to check that the symbol definitions imported by
the output loadfile are available through the libraries in its libList. You do this by
inserting -unres_symbols parameter, where parameter can have the values
error, warn, or ignore. When -unres_symbols is in effect, if the loadfile being
linked is localized, the linker searches for libraries and their symbols as defined in The
SearchList for a Localized Loadfile on page 4-5. On the other hand, if the loadfile being
linked is globalized or semi-globalized, the linker searches for libraries and their
symbols following a searchList that is identical to this loadfile’s loadList.
Until the linker finds a library that offers a symbol that the output loadfile needs, it
considers that symbol unresolved. After searching the libraries described above and
looking in the millicode libraries, if the linker cannot find an exported symbol to match
an imported one in the output loadfile, it will respond as specified by parameter. If
error is specified, the linker terminates and reports an error; if warn is specified, the
linker issues a warning message and continues; if ignore is specified, the linker does
not attempt to find matching symbols. If you do not specify -unres_symbols, the
default on TNS/R is to ignore unresolved symbols.
Also, when linking on a system other than the execution target, such as an auxiliary
system, be aware that certain libraries may be unavailable. This may cause an
inevitable error or warning if either is specified.
Also note that if you insert the option, -unres_symbols and also allow missing
libraries, then -unres_symbols automatically defaults to ignore.
Linker Output Controls
Designating the Main Entry Point of Your Program
When a program loadfile is linked, it must have a main entry point designated in one of
the following ways:
•
The input to the link must include a linkfile that contains a procedure that has the
main attribute. If you do not insert the -e entrypoint option, as described in
the next bullet, the linker will designate the procedure with the main attribute as the
entry point.
•
You explicitly designate the main entry point using the -e entrypoint option,
where entrypoint is the name of a global symbol definition. (It need not be
offered for export.)
PIC programs written in C or C++ are usually linked including a linkfile named
CPPLMAIN (Guardian) or cpplmain.o (OSS, Windows), which provides a function
named _MAIN() that has the main attribute. COBOL programs include a compiler-