1 / 14

Seminar on Dynamic Link Library (Dll)

Seminar on Dynamic Link Library (Dll). Presented By. Hetal Akabari. What is a Dll?. A dynamic-link library (DLL) is an executable file that acts as a shared library of functions. Dynamic linking provides a way for a process to call a function that is not part of its executable code.

trapper
Download Presentation

Seminar on Dynamic Link Library (Dll)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Seminar on Dynamic Link Library (Dll) Presented By Hetal Akabari

  2. What is a Dll? • A dynamic-link library (DLL) is an executable file that acts as a shared library of functions. • Dynamic linking provides a way for a process to call a function that is not part of its executable code. • The executable code for the function is located in a DLL, which contains one or more functions that are compiled, linked, and stored separately from the processes that use them. • DLLs also facilitate the sharing of data and resources. Multiple applications can simultaneously access the contents of a single copy of a DLL in memory.

  3. Examples of Important Dll Files • COMDLG32.DLL Controls the dialog boxes • GDI32.DLL Contains numerous functions for drawing graphics, displaying text, and managing fonts • KERNEL32.DLL Contains hundreds of functions for the management of memory and various processes • USER32.DLL Contains numerous user interface functions. Involved in the creation of program windows and their interactions with each other

  4. Kinds of Functions A DLL can define two kinds of functions: • Exported • The exported functions are intended to be called by other modules, as well as from within the DLL where they are defined. • Internal • Internal functions are typically intended to be called only from within the DLL where they are defined.

  5. Types of DLL When you load a DLL in an application, two methods of linking let you call the exported DLL functions.

  6. Load-time dynamic linking • In load-time dynamic linking, an application makes explicit calls to exported DLL functions like local functions. • To use load-time dynamic linking, provide a header (.h) file and an import library (.lib) file when you compile and link the application. • When you do this, the linker will provide the system with the information that is required to load the DLL and resolve the exported DLL function locations at load time.

  7. Run-time dynamic linking • In run-time dynamic linking, an application calls either the LoadLibraryfunction or the LoadLibraryExfunction to load the DLL at run time. • After the DLL is successfully loaded, you use the GetProcAddressfunction to obtain the address of the exported DLL function that you want to call. • When you use run-time dynamic linking, you do not need an import library file.

  8. Application Criteria • Startup performanceIf the initial startup performance of the application is important, you should use run-time dynamic linking. • Ease of useIn load-time dynamic linking, the exported DLL functions are like local functions. This makes it easy for you to call these functions. • Application logicIn run-time dynamic linking, an application can branch to load different modules as required. This is important when you develop multiple-language versions.

  9. Differences Between Applications and DLLs From the system's point of view, there are two fundamental differences between applications and DLLs: • An application can have multiple instances of itself running in the system simultaneously, whereas a DLL can have only one instance. • An application can own things such as a stack, global memory, file handles, and a message queue, but a DLL cannot.

  10. Dll Advantages • Saves memory and reduces swapping. Many processes can use a single DLL simultaneously, sharing a single copy of the DLL in memory. In contrast, Windows must load a copy of the library code into memory for each application that is built with a static link library. • Saves disk space. Many applications can share a single copy of the DLL on disk. In contrast, each application built with a static link library has the library code linked into its executable image as a separate copy. • Provides after-market support. For example, a display driver DLL can be modified to support a display that was not available when the application was shipped.

  11. Continue…. • Upgrades to the DLL are easier. When the functions in a DLL change, the applications that use them do not need to be recompiled or relinked as long as the function arguments and return values do not change. In contrast, statically linked object code requires that the application be relinked when the functions change. • Supports Multilanguage programs. Programs written in different programming languages can call the same DLL function as long as the programs follow the function's calling convention. The programs and the DLL function must be compatible in the following ways: the order in which the function expects its arguments to be pushed onto the stack, whether the function or the application is responsible for cleaning up the stack, and whether any arguments are passed in registers.

  12. Dll Disadvantages • The application is not self-contained; it depends on the existence of a separate DLL module. • The system terminates processes using load-time dynamic linking if they require a DLL that is not found at process startup and gives an error message to the user. The system does not terminate a process using run-time dynamic linking in this situation, but functions exported by the missing DLL are not available to the program.

  13. DLL dependencies When a program or a DLL uses a DLL function in another DLL, a dependency is created. Therefore, the program is no longer self-contained, and the program may experience problems if the dependency is broken. For example, the program may not run if one of the following actions occurs: • A dependent DLL is upgraded to a new version. • A dependent DLL is fixed. • A dependent DLL is overwritten with an earlier version. • A dependent DLL is removed from the computer. These actions are generally known as DLL conflicts. If backward compatibility is not enforced, the program may not successfully run.

  14. Question? Thank You

More Related