Kenwood HP 9000 Personal Computer User Manual


 
Chapter 3 63
Linker Tasks
Using Linker commands
In both cases, main2 will not be able to resolve its reference to
gal_to_liter() because only the convert_rtn() symbol is exported as
shown below:
Choosing Archive or Shared Libraries with -a
If both an archive and shared version of a particular library reside in the
same directory, ld links with the shared version. Occasionally, you might
want to override this behavior.
As an example, suppose you write an application that will run on a
system on which shared libraries may not be present. Since the program
could not run without the shared library, it would be best to link with the
archive library, resulting in executable code that contains the required
library routines. See also “Caution When Mixing Shared and Archive
Libraries” on page 164.
Option Settings to -a
The -a option tells the linker what kind of library to link with. It applies
to all libraries (-l options) until the end of the command line or until the
next -a option. Its syntax is:
-a {archive | shared | default | archive_shared | shared_archive}
The different option settings are:
main () {
convert_rtn ();
main1
main () {
gal_to_liter();
libunits.sl
Only convert_rtn
symbol is
visible.
gal_to_liter() { }
convert_rtn() {
}
}
Unsatisfied symbol: gal_to_liter (at link-time)
main2
gal_to_liter();
}