
Static and Dynamic Linking of C Runtime Libraries with VS2010
Linking Types
A C or C++ program compiled on Windows almost invariably uses the C Runtime Libary (CRT). This set of functions comes with your default Windows installation and provides some of the most basic operations, read this page for details. Now, remember that the last step of creating an EXE is called linking — the process that combines one or more compiled objects and combines them into a single executable.This post describes how to change your CRT linking method to control the size of your EXE file. There are two ways to link an external library such as a DLL.
- Static linking: All library routines used in the program are copied into the final EXE file. This means there is no dependency on some file existing at run-time.
- Dynamic linking: Both the name of a shareable library and the functions you use from that library are placed in the EXE file. When the executable is loaded, the operating system needs to do some extra work to locate this library and map it into your program’s virtual memory.
There is actually a third, “super-dynamic” way of loading DLL’s : calling a loadLibrary() function in your code. This means that you can load different libraries…