Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> dynamic linking vs static linking</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Dynamic linking vs static linking
------------------------------------------------------------------------------
 In high-level programming languages such as C, Pascal, or FORTRAN, an
 application's source code must be compiled and linked to various libraries
 to create an executable file. When these library functions are linked to an
 application, they become a permanent part of the application's executable
 file. All calls to the library functions are resolved at link time, hence
 the name static linking.

 Dynamic linking provides a mechanism to link applications to libraries at
 run time. The libraries reside in their own executable files and are not
 copied into the executable files of the application as with static linking.
 These libraries are called dynamic link libraries (DLLs) to emphasize that
 they are linked to an application when it is loaded and executed, rather
 than when it is linked.

 DLLs differ considerably from static link libraries, with the basic
 differences between the two being:

 . Static link libraries reside in .LIB files, which are basically
   collections of object files, whereas dynamic-link libraries reside in
   separate executable files that are loaded by Windows into memory as needed.

 . Static link libraries contain only code and data because they are
   stored as a collection of object files. Windows DLLs, on the other hand,
   can contain code, data, and resources such as bitmaps, icons, and cursors,
   because they are stored as executable program files.

 . Static link libraries must use the data segment of the application,
   whereas DLLs may (and often do) have their own data segments.

 When an application uses a DLL, the operating system loads the DLL into
 memory, resolves references to functions in the DLL so that they can be
 called by the application, and unloads the DLL when it is no longer needed.
 It should be noted that although application .EXEs can import, i.e. use,
 functions in DLLs, and DLLs can import functions in other DLLs, DLLs cannot
 import functions from the main application .EXE, as the importing mechanism
 only supports importing from named modules.
 Dynamic linking can occur in two ways:

 . Implicit dynamic linking is performed at load time by the operating
   system. When the operating system loads an application or DLL, it first
   loads any dependent DLLs, i.e. any DLLs which the application uses, and
   any  DLLs which they use.

 . Explicit dynamic linking is performed at run time by the application
   or DLL itself, by making calls to the operating system to load the DLL
   and to resolve symbols within the DLL.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson