Oracle® Solaris 11.2 Linkers and Libraries Guide

Exit Print View

Updated: July 2014

Creating a Static Executable

Note - The use of static executables is limited. See Static Executables. Static executables usually contain platform-specific implementation details that restrict the ability of the executable to be run on an alternative platform, or version of the operating system. Many implementations of Oracle Solaris shared objects depend on dynamic linking facilities, such as dlopen(3C) and dlsym(3C). See Loading Additional Objects. These facilities are not available to static executables.

To create a static executable use the –d n option without the –r option.

$ 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.