62 Chapter 3
Linker Tasks
Using Linker commands
Figure 3-1 Symbols inside a Shared Library Visible with -B symbolic
Case 2: Building a Shared Library with -h or +e. The -h (hide
symbol) and +e (export symbol) options can also optimize the call path in
a shared library for symbols that are explicitly hidden. However, only the
exported symbols are visible outside of the shared library.
For example, you could hide the gal_to_liter symbol as shown:
$ ld -b convert.o -h gal_to_liter volume.o -o libunits.sl
or export the convert_rtn symbol:
$ ld -b +e convert_rtn convert.o volume.o -o libunits.sl
main () {
convert_rtn();
main1
main () {
gal_to_liter();
libunits.sl
}
main2
convert_rtn() {
Direct call path
}
gal_to_liter();
}
gal_to_liter() { }
Both convert_rtn and
gal_to_liter symbols
are visible.