DLLs in Visual C++
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.
Dynamic linking differs from static linking in that it allows an executable module (either a .dll or .exe file) to include only the information needed at run time to locate the executable code for a DLL function. In static linking, the linker gets all of the referenced functions from the static link library and places it with your code into your executable.
Using dynamic linking instead of static linking offers several advantages. DLLs save memory, reduce swapping, save disk space, upgrade easier, provide after-market support, provide a mechanism to extend the MFC library classes, support multilanguage programs, and ease the creation of international versions.
The following topics provide detailed information about programming DLLs.
In This Section
Walkthrough: Creating and Using a Dynamic Link Library (C++)
Describes how to create and use a DLL using Visual Studio.
How to: Create Class Libraries
How to create a class library by using the project templates.
Differences Between Applications and DLLs
Describes the fundamental differences between applications and DLLs.
Advantages of Using DLLs
Describes the advantages of dynamic linking.
Kinds of DLLs
Provides information about the different kinds of DLLs that can be built.
DLL Frequently Asked Questions
Provides answers to frequently asked questions about DLLs.
Linking an Executable to a DLL
Describes explicit and implicit linking to a DLL.
Initializing a DLL
Discusses DLL initialization code (such as allocating memory) that must execute when your DLL loads.
Run-Time Library Behavior
Describes how the run-time library performs the DLL startup sequence.
LoadLibrary and AfxLoadLibrary
Discusses using LoadLibrary and AfxLoadLibrary to explicitly link to a DLL.
Discusses using GetProcAddress to obtain the address of an exported function in the DLL.
FreeLibrary and AfxFreeLibrary
Discusses using FreeLibrary and AfxFreeLibrary when the DLL module is no longer needed.
Search Path Used by Windows to Locate a DLL
Describes the search path that the Windows operating system uses to locate a DLL on your system.
Module States of a Regular DLL Dynamically Linked to MFC
Describes the module states of a regular DLL dynamically linked to MFC.
Explains DLLs that typically implements reusable classes derived from the existing Microsoft Foundation Class Library classes.
Creating a Resource-Only DLL
Discusses a resource-only DLL, which contains nothing but resources, such as icons, bitmaps, strings, and dialog boxes.
Localized Resources in MFC Applications: Satellite DLLs
Provides enhanced support for satellite DLLs, a feature that helps in creating applications localized for multiple languages.
Importing and Exporting
Describes importing public symbols into an application or exporting functions from a DLL
Active Technology and DLLs
Allows object servers to be completely implemented inside a DLL.
Automation in a DLL
Describes what the Automation option in the MFC DLL Wizard supplies.
Naming Conventions for MFC DLLs
Discusses how the DLLs and libraries included in MFC follow a structured naming convention.
Calling DLL functions from Visual Basic Applications
Describes how to call DLL functions from Visual Basic applications.
Using MFC as Part of a DLL
Describes regular DLLs, which allow you to use the MFC library as part of a Windows dynamic-link library.
DLL Version of MFC
Describes how you can use the MFCxx.dll and MFCxxD.dll (where x is the MFC version number) shared dynamic-link libraries with MFC applications and extension DLLs.
Visual C++ Programming Methodologies
Provides links to topics describing conceptual information about the Visual C++ libraries and topics discussing various coding technologies and techniques.