Prefer dynamic or require static library linking.
No space is allowed between -B and dynamic or static. The default, without -B specified, is -Bdynamic.
If you specify static, but the linker finds only a dynamic library, then the library is not linked with a warning that the “library was not found.”
If you specify dynamic, but the linker finds only a static version, then that library is linked, with no warning.
You can toggle -Bstatic and -Bdynamic on the command line. That is, you can link some libraries statically and some dynamically by specifying -Bstatic and -Bdynamic any number of times on the command line, as follows:
f95 prog.f -Bdynamic -lwells -Bstatic -lsurface
You cannot specify both -Bdynamic and -dn on the command line because -dn disables linking of dynamic libraries.
In a 64-bit Solaris environment, many system libraries are available only as shared dynamic libraries. These include libm.so and libc.so (libm.a and libc.a are not provided). This means that -Bstatic and -dn may cause linking errors in 64-bit Solaris environments. Applications must link with the dynamic libraries in these cases.
Mixing static Fortran runtime system libraries with dynamic Fortran runtime system libraries is not recommended and can result in linker errors or silent data corruption. Always link with the latest shared dynamic Fortran runtime system libraries.
See the Fortran Programming Guide for more information on static and dynamic libraries.