Skip to content

Commit fc9bed0

Browse files
author
Colin Robertson
committed
Merge remote-tracking branch 'refs/remotes/MicrosoftDocs/master'
2 parents 74926d3 + a0b2a00 commit fc9bed0

File tree

224 files changed

+3357
-2820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+3357
-2820
lines changed

docs/TOC.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# [Data Access](data/data-access-in-cpp.md)
1717
# [Text and Strings](text/text-and-strings-in-visual-cpp.md)
1818
# [vcpkg: A Package Manager for C++](vcpkg.md)
19-
# [Using the Visual Studio IDE for C++](ide/ide-and-tools-for-visual-cpp-development.md)
19+
# [IDE and Tools for Visual C++](ide/ide-and-tools-for-visual-cpp-development.md)
2020
# [Compilers and Build Tools](build/building-c-cpp-programs.md)
2121
# [Porting and Upgrading Visual C++ Code](porting/visual-cpp-porting-and-upgrading-guide.md)
2222
# [Security Best Practices for C++](security/security-best-practices-for-cpp.md)

docs/atl-mfc-shared/codesnippet/CPP/afx-extension-module-structure_1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
99
{
1010
TRACE0("NVC_MFC_DLL.DLL Initializing!\n");
1111

12-
// Extension DLL one-time initialization
12+
// MFC extension DLL one-time initialization
1313
if (!AfxInitExtensionModule(NVC_MFC_DLLDLL, hInstance))
1414
return 0;

docs/atl/benefits-and-tradeoffs-of-the-method-used-to-link-to-the-crt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ Your project can link with the CRT either dynamically or statically. The table b
4444

4545
## See Also
4646
[Programming with ATL and C Run-Time Code](../atl/programming-with-atl-and-c-run-time-code.md)
47-
[Run-Time Library Behavior](../build/run-time-library-behavior.md)
47+
[DLLs and Visual C++ run-time library behavior](../build/run-time-library-behavior.md)
4848
[CRT Library Features](../c-runtime-library/crt-library-features.md)
4949

docs/atl/linking-to-the-crt-in-your-atl-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ The [C Run-Time Libraries](../c-runtime-library/crt-library-features.md) (CRT) p
5555

5656
## See Also
5757
[Programming with ATL and C Run-Time Code](../atl/programming-with-atl-and-c-run-time-code.md)
58-
[Run-Time Library Behavior](../build/run-time-library-behavior.md)
58+
[DLLs and Visual C++ run-time library behavior](../build/run-time-library-behavior.md)
5959

docs/atl/programming-with-atl-and-c-run-time-code.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ This section discusses the benefits of using the C Run-Time Library (CRT) with e
4949
[ATL](../atl/active-template-library-atl-concepts.md)
5050
Provides links to conceptual topics on how to program using the Active Template Library.
5151

52-
[Run-Time Library Behavior](../build/run-time-library-behavior.md)
53-
Provides details on how the CRT startup code works.
52+
[DLLs and Visual C++ run-time library behavior](../build/run-time-library-behavior.md)
53+
Provides details on how the VCRuntime and CRT startup code works.
5454

5555
[C Run-Time Libraries](../c-runtime-library/crt-library-features.md)
5656
Discusses the various .lib files that comprise the C run-time libraries and lists their associated compiler options and preprocessor directives.

docs/atl/reference/ccomobjectrootex-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static void WINAPI ObjectMain(bool bStarting);
288288
### Remarks
289289
The value of the `bStarting` parameter indicates whether the module is being initialized or terminated. The default implementation of `ObjectMain` does nothing, but you can override this function in your class to initialize or clean up resources that you want to allocate for the class. Note that `ObjectMain` is called before any instances of the class are requested.
290290

291-
`ObjectMain` is called from the entry point of the DLL, so the type of operation that the entry-point function can perform is restricted. For more information on these restrictions, see [Run-Time Library Behavior](../../build/run-time-library-behavior.md) and [DllMain](http://msdn.microsoft.com/library/windows/desktop/ms682583).
291+
`ObjectMain` is called from the entry point of the DLL, so the type of operation that the entry-point function can perform is restricted. For more information on these restrictions, see [DLLs and Visual C++ run-time library behavior](../../build/run-time-library-behavior.md) and [DllMain](http://msdn.microsoft.com/library/windows/desktop/ms682583).
292292

293293
### Example
294294
[!code-cpp[NVC_ATL_COM#41](../../atl/codesnippet/cpp/ccomobjectrootex-class_2.h)]

docs/build/TOC.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,21 @@
6161
## [ARM Exception Handling](arm-exception-handling.md)
6262
# [DLLs in Visual C++](dlls-in-visual-cpp.md)
6363
## [Walkthrough: Creating and Using a Dynamic Link Library (C++)](walkthrough-creating-and-using-a-dynamic-link-library-cpp.md)
64-
## [Differences Between Applications and DLLs](differences-between-applications-and-dlls.md)
65-
## [Advantages of Using DLLs](advantages-of-using-dlls.md)
6664
## [Kinds of DLLs](kinds-of-dlls.md)
6765
### [Non-MFC DLLs: Overview](non-mfc-dlls-overview.md)
68-
### [Regular DLLs Statically Linked to MFC](regular-dlls-statically-linked-to-mfc.md)
69-
### [Regular DLLs Dynamically Linked to MFC](regular-dlls-dynamically-linked-to-mfc.md)
70-
### [Extension DLLs: Overview](extension-dlls-overview.md)
66+
### [Regular MFC DLLs Statically Linked to MFC](regular-dlls-statically-linked-to-mfc.md)
67+
### [Regular MFC DLLs Dynamically Linked to MFC](regular-dlls-dynamically-linked-to-mfc.md)
68+
### [MFC extension DLLs: Overview](extension-dlls-overview.md)
7169
## [MFC DLL Frequently Asked Questions](dll-frequently-asked-questions.md)
72-
## [Linking an Executable to a DLL](linking-an-executable-to-a-dll.md)
73-
### [Determining Which Linking Method to Use](determining-which-linking-method-to-use.md)
74-
### [Linking Implicitly](linking-implicitly.md)
75-
### [Linking Explicitly](linking-explicitly.md)
76-
## [Initializing a DLL](initializing-a-dll.md)
77-
### [Initializing Regular DLLs](initializing-regular-dlls.md)
78-
### [Initializing Extension DLLs](initializing-extension-dlls.md)
79-
### [Initializing Non-MFC DLLs](initializing-non-mfc-dlls.md)
80-
## [Run-Time Library Behavior](run-time-library-behavior.md)
70+
## [Link an executable to a DLL](linking-an-executable-to-a-dll.md)
71+
## [DLLs and Visual C++ run-time library behavior](run-time-library-behavior.md)
8172
## [LoadLibrary and AfxLoadLibrary](loadlibrary-and-afxloadlibrary.md)
8273
## [GetProcAddress](getprocaddress.md)
8374
## [FreeLibrary and AfxFreeLibrary](freelibrary-and-afxfreelibrary.md)
8475
## [Search Path Used by Windows to Locate a DLL](search-path-used-by-windows-to-locate-a-dll.md)
85-
## [Module States of a Regular DLL Dynamically Linked to MFC](module-states-of-a-regular-dll-dynamically-linked-to-mfc.md)
86-
## [Extension DLLs](extension-dlls.md)
87-
### [Using Database, OLE, and Sockets Extension DLLs in Regular DLLs](using-database-ole-and-sockets-extension-dlls-in-regular-dlls.md)
76+
## [Module States of a Regular MFC DLL Dynamically Linked to MFC](module-states-of-a-regular-dll-dynamically-linked-to-mfc.md)
77+
## [MFC extension DLLs](extension-dlls.md)
78+
### [Using Database, OLE, and Sockets MFC extension DLLs in regular MFC DLLs](using-database-ole-and-sockets-extension-dlls-in-regular-dlls.md)
8879
## [Creating a Resource-Only DLL](creating-a-resource-only-dll.md)
8980
## [Localized Resources in MFC Applications: Satellite DLLs](localized-resources-in-mfc-applications-satellite-dlls.md)
9081
## [Importing and Exporting](importing-and-exporting.md)
Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,3 @@
11
---
2-
title: "Advantages of Using DLLs | Microsoft Docs"
3-
ms.custom: ""
4-
ms.date: "11/04/2016"
5-
ms.reviewer: ""
6-
ms.suite: ""
7-
ms.technology:
8-
- "cpp-tools"
9-
ms.tgt_pltfrm: ""
10-
ms.topic: "article"
11-
dev_langs:
12-
- "C++"
13-
helpviewer_keywords:
14-
- "DLLs [C++], advantages"
15-
- "dynamic linking [C++]"
16-
- "linking [C++], dynamic vs. static"
17-
- "dynamic load linking [C++]"
18-
- "links [C++], dynamic vs. static"
19-
ms.assetid: 8956c8ee-e7b3-446f-a0c6-462381747690
20-
caps.latest.revision: 9
21-
author: "corob-msft"
22-
ms.author: "corob"
23-
manager: "ghogen"
24-
translation.priority.ht:
25-
- "cs-cz"
26-
- "de-de"
27-
- "es-es"
28-
- "fr-fr"
29-
- "it-it"
30-
- "ja-jp"
31-
- "ko-kr"
32-
- "pl-pl"
33-
- "pt-br"
34-
- "ru-ru"
35-
- "tr-tr"
36-
- "zh-cn"
37-
- "zh-tw"
2+
redirect_url: /cpp/build/dlls-in-visual-cpp#advantages-of-using-dlls
383
---
39-
# Advantages of Using DLLs
40-
Dynamic linking has the following advantages:
41-
42-
- 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.
43-
44-
- 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.
45-
46-
- 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.
47-
48-
- 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.
49-
50-
- 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.
51-
52-
- Provides a mechanism to extend the MFC library classes. You can derive classes from the existing MFC classes and place them in an MFC extension DLL for use by MFC applications.
53-
54-
- Eases the creation of international versions. By placing resources in a DLL, it is much easier to create international versions of an application. You can place the strings for each language version of your application in a separate resource DLL and have the different language versions load the appropriate resources.
55-
56-
A potential disadvantage to using DLLs is that the application is not self-contained; it depends on the existence of a separate DLL module.
57-
58-
## What do you want to do?
59-
60-
- [Export from a DLL](../build/exporting-from-a-dll.md)
61-
62-
- [Link an executable to a DLL](../build/linking-an-executable-to-a-dll.md)
63-
64-
- [Initialize a DLL](../build/initializing-a-dll.md)
65-
66-
## What do you want to know more about?
67-
68-
- [Non-MFC DLLs: Overview](../build/non-mfc-dlls-overview.md)
69-
70-
- [Regular DLLs statically linked to MFC](../build/regular-dlls-statically-linked-to-mfc.md)
71-
72-
- [Regular DLLs dynamically linked to MFC](../build/regular-dlls-dynamically-linked-to-mfc.md)
73-
74-
- [Extension DLLs: Overview](../build/extension-dlls-overview.md)
75-
76-
## See Also
77-
[DLLs in Visual C++](../build/dlls-in-visual-cpp.md)

docs/build/determining-which-exporting-method-to-use.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ You can export functions in either of two ways—a .def file or the `__declspec(
6868

6969
- [Import into an application using __declspec(dllimport)](../build/importing-into-an-application-using-declspec-dllimport.md)
7070

71-
- [Initialize a DLL](../build/initializing-a-dll.md)
71+
- [Initialize a DLL](../build/run-time-library-behavior.md#initializing-a-dll)
7272

7373
### What do you want to know more about?
7474

Lines changed: 1 addition & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,3 @@
11
---
2-
title: "Determining Which Linking Method to Use | Microsoft Docs"
3-
ms.custom: ""
4-
ms.date: "11/04/2016"
5-
ms.reviewer: ""
6-
ms.suite: ""
7-
ms.technology:
8-
- "cpp-tools"
9-
ms.tgt_pltfrm: ""
10-
ms.topic: "article"
11-
dev_langs:
12-
- "C++"
13-
helpviewer_keywords:
14-
- "implicit linking [C++]"
15-
- "explicit linking [C++]"
16-
ms.assetid: 6b6d3fec-4711-4a30-af5b-354b965ecaec
17-
caps.latest.revision: 9
18-
author: "corob-msft"
19-
ms.author: "corob"
20-
manager: "ghogen"
21-
translation.priority.ht:
22-
- "cs-cz"
23-
- "de-de"
24-
- "es-es"
25-
- "fr-fr"
26-
- "it-it"
27-
- "ja-jp"
28-
- "ko-kr"
29-
- "pl-pl"
30-
- "pt-br"
31-
- "ru-ru"
32-
- "tr-tr"
33-
- "zh-cn"
34-
- "zh-tw"
2+
redirect_url: /cpp/build/linking-an-executable-to-a-dll#determining-which-linking-method-to-use
353
---
36-
# Determining Which Linking Method to Use
37-
There are two types of linking: implicit linking and explicit linking.
38-
39-
## Implicit Linking
40-
[Implicit linking](../build/linking-implicitly.md) occurs when an application's code calls an exported DLL function. When the source code for the calling executable is compiled or assembled, the DLL function call generates an external function reference in the object code. To resolve this external reference, the application must link with the import library (.lib file) provided by the maker of the DLL.
41-
42-
The import library only contains code to load the DLL and to implement calls to functions in the DLL. Finding an external function in an import library informs the linker that the code for that function is in a DLL. To resolve external references to DLLs, the linker simply adds information to the executable file that tells the system where to find the DLL code when the process starts up.
43-
44-
When the system starts a program that contains dynamically linked references, it uses the information in the program's executable file to locate the required DLLs. If it cannot locate the DLL, the system terminates the process and displays a dialog box that reports the error. Otherwise, the system maps the DLL modules into the process's address space.
45-
46-
If any of the DLLs has an entry-point function (for initialization and termination code), the operating system calls the function. One of the parameters passed to the entry-point function specifies a code that indicates the DLL is attaching to the process. If the entry-point function does not return TRUE, the system terminates the process and reports the error.
47-
48-
Finally, the system modifies the executable code of the process to provide starting addresses for the DLL functions.
49-
50-
Like the rest of a program's code, DLL code is mapped into the address space of the process when the process starts up and it is loaded into memory only when needed. As a result, the **PRELOAD** and **LOADONCALL** code attributes used by .def files to control loading in previous versions of Windows no longer have meaning.
51-
52-
## Explicit Linking
53-
Most applications use implicit linking because it is the easiest linking method to use. However, there are times when [explicit linking](../build/linking-explicitly.md) is necessary. Here are some common reasons to use explicit linking:
54-
55-
- The application does not know the name of a DLL that it will have to load until run time. For example, the application might need to obtain the name of the DLL and the exported functions from a configuration file.
56-
57-
- A process using implicit linking is terminated by the operating system if the DLL is not found at process startup. A process using explicit linking is not terminated in this situation and can attempt to recover from the error. For example, the process could notify the user of the error and have the user specify another path to the DLL.
58-
59-
- A process using implicit linking is also terminated if any of the DLLs it is linked to have a `DllMain` function that fails. A process using explicit linking is not terminated in this situation.
60-
61-
- An application that implicitly links to many DLLs can be slow to start because Windows loads all the DLLs when the application loads. To improve startup performance, an application can implicitly link to those DLLs needed immediately after loading and wait to explicitly link to the other DLLs when they are needed.
62-
63-
- Explicit linking eliminates the need to link the application with an import library. If changes in the DLL cause the export ordinals to change, applications using explicit linking do not have to relink (assuming they are calling **GetProcAddress** with a name of a function and not with an ordinal value), whereas applications using implicit linking must relink to the new import library.
64-
65-
Here are two hazards of explicit linking to be aware of:
66-
67-
- If the DLL has a `DllMain` entry point function, the operating system calls the function in the context of the thread that called **LoadLibrary**. The entry-point function is not called if the DLL is already attached to the process because of a previous call to **LoadLibrary** with no corresponding call to the **FreeLibrary** function. Explicit linking can cause problems if the DLL is using a `DllMain` function to perform initialization for each thread of a process because threads existing when **LoadLibrary** (or `AfxLoadLibrary`) is called will not be initialized.
68-
69-
- If a DLL declares static-extent data as **__declspec(thread)**, it can cause a protection fault if explicitly linked. After the DLL is loaded with **LoadLibrary**, it causes a protection fault whenever the code references this data. (Static-extent data includes both global and local static items.) Therefore, when you create a DLL, you should either avoid using thread-local storage or inform DLL users about potential pitfalls (in case they attempt dynamic loading).
70-
71-
## What do you want to do?
72-
73-
- [Link implicitly](../build/linking-implicitly.md)
74-
75-
- [Link explicitly](../build/linking-explicitly.md)
76-
77-
## What do you want to know more about?
78-
79-
- [The search path used by Windows to locate a DLL](../build/search-path-used-by-windows-to-locate-a-dll.md)
80-
81-
- [LoadLibrary and AfxLoadLibrary](../build/loadlibrary-and-afxloadlibrary.md)
82-
83-
- [GetProcAddress](../build/getprocaddress.md)
84-
85-
- [FreeLibrary and AfxFreeLibrary](../build/freelibrary-and-afxfreelibrary.md)
86-
87-
- [Using thread local storage in a dynamic-link library (Windows SDK)](http://msdn.microsoft.com/library/windows/desktop/ms686997)
88-
89-
## See Also
90-
[Linking an Executable to a DLL](../build/linking-an-executable-to-a-dll.md)
Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,3 @@
11
---
2-
title: "Differences Between Applications and DLLs | Microsoft Docs"
3-
ms.custom: ""
4-
ms.date: "11/04/2016"
5-
ms.reviewer: ""
6-
ms.suite: ""
7-
ms.technology:
8-
- "cpp-tools"
9-
ms.tgt_pltfrm: ""
10-
ms.topic: "article"
11-
dev_langs:
12-
- "C++"
13-
helpviewer_keywords:
14-
- "executable files [C++], DLLs vs. applications"
15-
- "DLLs [C++], vs. applications"
16-
- "applications [C++], vs. DLLs"
17-
ms.assetid: 8f271523-d8d0-4ad1-84d2-0c5645d7fd5b
18-
caps.latest.revision: 8
19-
author: "corob-msft"
20-
ms.author: "corob"
21-
manager: "ghogen"
22-
translation.priority.ht:
23-
- "cs-cz"
24-
- "de-de"
25-
- "es-es"
26-
- "fr-fr"
27-
- "it-it"
28-
- "ja-jp"
29-
- "ko-kr"
30-
- "pl-pl"
31-
- "pt-br"
32-
- "ru-ru"
33-
- "tr-tr"
34-
- "zh-cn"
35-
- "zh-tw"
2+
redirect_url: /cpp/build/dlls-in-visual-cpp#differences-between-applications-and-dlls
363
---
37-
# Differences Between Applications and DLLs
38-
Even though DLLs and applications are both executable program modules, they differ in several ways. To the end user, the most obvious difference is that DLLs are not programs that can be directly executed. From the system's point of view, there are two fundamental differences between applications and DLLs:
39-
40-
- An application can have multiple instances of itself running in the system simultaneously, whereas a DLL can have only one instance.
41-
42-
- An application can own things such as a stack, global memory, file handles, and a message queue, but a DLL cannot.
43-
44-
## What do you want to do?
45-
46-
- [Export from a DLL](../build/exporting-from-a-dll.md)
47-
48-
- [Link an executable to a DLL](../build/linking-an-executable-to-a-dll.md)
49-
50-
- [Initialize a DLL](../build/initializing-a-dll.md)
51-
52-
## What do you want to know more about?
53-
54-
- [The advantages of using DLLs](../build/advantages-of-using-dlls.md)
55-
56-
- [Non-MFC DLLs: Overview](../build/non-mfc-dlls-overview.md)
57-
58-
- [Regular DLLs statically linked to MFC](../build/regular-dlls-statically-linked-to-mfc.md)
59-
60-
- [Regular DLLs dynamically linked to MFC](../build/regular-dlls-dynamically-linked-to-mfc.md)
61-
62-
- [Extension DLLs: Overview](../build/extension-dlls-overview.md)
63-
64-
## See Also
65-
[DLLs in Visual C++](../build/dlls-in-visual-cpp.md)

0 commit comments

Comments
 (0)