You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp.md
+20-6Lines changed: 20 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Walkthrough: Creating and Using a Dynamic Link Library (C++) | Microsoft Docs"
2
+
title: "Walkthrough: Create and use your own Dynamic Link Library (C++) | Microsoft Docs"
3
3
ms.custom: ""
4
4
ms.date: "11/04/2016"
5
5
ms.reviewer: ""
@@ -34,10 +34,15 @@ translation.priority.mt:
34
34
- "pt-br"
35
35
- "tr-tr"
36
36
---
37
-
# Walkthrough: Creating and Using a Dynamic Link Library (C++)
38
-
This step-by-step walkthrough shows how to create a dynamic link library (DLL) for use with a C++ app. Using a library is a great way to reuse code. Rather than re-implementing the same routines in every program that you create, you write them one time and then reference them from apps that require the functionality. By putting code in the DLL, you save space in every app that references it, and you can update the DLL without recompiling all of the apps that use it. For more information about DLLs, see [DLLs in Visual C++](../build/dlls-in-visual-cpp.md).
37
+
# Walkthrough: Create and use your own Dynamic Link Library (C++)
39
38
40
-
This walkthrough covers these tasks:
39
+
This step-by-step walkthrough shows how to use Visual Studio to create your own dynamic link library (DLL) written in C++, and use it from another C++ app.
40
+
41
+
A DLL is a Windows operating system-specific component that contains a library of resources and executable code. There are a lot of advantages to using DLLs as part of your apps. A DLL can be statically linked to your app, like a regular code library, or it can be dynamically linked at runtime. Like a library, you can use the code and resources in a DLL from several apps at once. You can update the code in a DLL separately, and then use the new code in all the applications that link to it without recompiling them. For more information about DLLs, see [DLLs in Visual C++](../build/dlls-in-visual-cpp.md).
42
+
43
+
A Windows DLL doesn't have a direct equivalent in the Standard C++ code model. Visual C++ provides some extensions to the C++ model to support creation and use of DLLs. We'll explain these extensions as we go.
44
+
45
+
This walkthrough covers these tasks:
41
46
42
47
- Create a DLL project.
43
48
@@ -49,12 +54,21 @@ This step-by-step walkthrough shows how to create a dynamic link library (DLL) f
49
54
50
55
- Run the completed app.
51
56
52
-
This walkthrough creates a DLL that can be called from apps that use C++ calling conventions. This requires both the DLL and the client app to be built by using the same compiler toolset, so that the internal naming conventions match. It's also possible to create DLLs that can be called from apps written in other languages and built using other compilers by using the C calling convention. For more information about specifying C linkage, see [Exporting C++ Functions for Use in C-Language Executables](../build/exporting-cpp-functions-for-use-in-c-language-executables.md). For information about how to create DLLs for use with other languages, see [Calling DLL Functions from Visual Basic Applications](../build/calling-dll-functions-from-visual-basic-applications.md).
57
+
The walkthrough creates a DLL that can be called from apps that use C++ calling conventions. This requires both the DLL and the client app to be built by using the same compiler toolset, so that the internal naming conventions match. It's also possible to create DLLs that can be called from apps written in other languages and built using other compilers by using the C calling convention. For more information about specifying C linkage, see [Exporting C++ Functions for Use in C-Language Executables](../build/exporting-cpp-functions-for-use-in-c-language-executables.md). For information about how to create DLLs for use with other languages, see [Calling DLL Functions from Visual Basic Applications](../build/calling-dll-functions-from-visual-basic-applications.md).
53
58
54
59
This simple walkthrough uses a combined solution that contains both the DLL and the client app, and uses implicit linking at load-time to import the DLLs functions. A more common situation involves third-party DLLs that are not built as part of your solution, or that use explicit linkage to load the DLLs at run-time rather than at load-time. For more information about implicit linking and explicit linking, see [Determining Which Linking Method to Use](../build/determining-which-linking-method-to-use.md).
55
60
56
61
## Prerequisites
57
-
This topic assumes that you understand the fundamentals of the C++ language and the basics of using the Visual Studio IDE. The Visual C++ components must be installed in Visual Studio to use this walkthrough.
62
+
63
+
- A computer that runs Microsoft Windows 7 or later versions. We recommend Windows 10 for the best development experience.
64
+
65
+
- A copy of Visual Studio 2017. For information on how to download and install Visual Studio, see [Install Visual Studio 2017](/visualstudio/install/install-visual-studio). When you run (or re-run) the installer, make sure that the **Desktop development with C++** workload is checked.
66
+
67
+

68
+
69
+
- An understanding of the basics of using the Visual Studio IDE. If you've used Windows desktop apps before, you can probably follow along. For a more complete introduction, see [Visual Studio IDE feature tour](/visualstudio/ide/visual-studio-ide).
70
+
71
+
- An understanding of enough of the fundamentals of the C++ language to follow along. Don't worry, we won't do anything too complicated.
58
72
59
73
### To create a dynamic link library (DLL) project
0 commit comments