By default, unless we explicitly specify by using a linker flag such as -Bstatic, the linker on Solaris will search a given directory for a shared object and link against the shared library if it is available. This means that the external reference will not be resolved until the code starts running and even then the linking will not take effect until an actual call is made to the routine requiring that library.
If the linker couldn't find the relevant shared object in the search path, it will search for an archive (static) library. In the case of static libraries the actual code to execute the external routine will be physically copied into the executable.
-Bdynamic & -Bstatic options of Solaris linker provides finer control of which library, shared or static should searched for each library specified on the link line. One advantage of the method of explicitly specifying which librariess we want static and which we want dynamic is that we don't have to hardcode full paths to any libraries (more portable and easier to maintain).
The library search option can be toggled between shared objects and archives by specifying -Bdynamic and -Bstatic on the command line as many times as required.
CC -Bstatic -lstatic -Bdynamic -ldyn -o driver driver.o
This command tells the linker to search for only static library of libstatic, and search for libdyn.so until the search exhausts, before the next search for libdyn.a archive begins. In other words, the link-editor (ld aka linker) first searches for libstatic.a, and then for libdyn.so, and if that fails, then for libdyn.a.
With -Bstatic option, the linker does not accept shared objects as input until the next occurrence of -Bdynamic. However, with -Bdynamic option, the linker first looks for shared objects and then archives in any given directory.
Reference:Solaris Linker and Libraries Guide