Linker and Libraries Guide

Creating a Static Executable

The use of static executables is limited. Static executables usually contain platform-specific implementation details that restricts the ability of the executable to be run on an alternative platform. Many implementations of Solaris libraries depend on dynamic linking capabilities, such as dlopen(3DL) and dlsym(3DL). See "Loading Additional Objects". These capabilities are not available to static executables.


$ cc -dn -o prog file1.o file2.o file3.o .....

The -a option is available to indicate the creation of a static executable. The use of -d n without a -r implies -a.