### Static and Dynamic Linking

Static linking means that code for all the IBM C and C++ Compilers runtime functions called in your program is copied from a library file into your output .EXE or .DLL file. The executable or dynamic link library files will be larger because there is a copy of the run-time functions in each file. These programs will use more storage, and if you run them at the same time, there will also be a copy of the library functions in memory for each program. Statically linked programs, however, are easier to distribute because the library functions are part of your executable file.

Dynamic linking means that code for the IBM C and C++ Compilers run-time functions called in your program is not copied into your output file. Instead, the function code stays in a separate IBM C and C++ Compilers dynamic link library file, and your calls to the function are resolved at load time. The amount of disk space required by your output file is reduced, and there is only one copy of the library functions in memory for all programs that use them. Dynamically linked programs can be harder to distribute, since the separate dynamic link library file must be distributed along with your executable file.

Use the /Gd compiler option to control whether your executable file links to the run-time library statically or dynamically.

If you override the default libraries with the /NOD linker option, you must explicitly give the name of all libraries you are using on the linker command line.

You can also statically or dynamically link to other libraries.

Under the IBM C and C++ Compilers licensing agreement, you cannot ship the IBM C and C++ Compilers DLLs as they are with a product that you develop. If you want to dynamically link to the IBM C and C++ Compilers library, you can create your own version of the runtime DLLs, or use the DLLRNAME utility to rename the IBM C and C++ Compilers DLLs before you ship them.

Linking
Dynamic Link Libraries

Supply DLLs for Locale Handling

Summary of Linker Options