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
{{ message }}
Repository navigation
Commit b0c662c
Browse filesBrowse the repository at this point in the historyBrowse files
Aligns the next variable or instruction on a byte that is a multiple of *number*.
10
+
The **ALIGN** directive aligns the next data element or instruction on an address that is a multiple of its parameter. The parameter must be a power of 2 (for example, 1, 2, 4, and so on) that is less than or equal to the segment alignment.
11
11
12
12
## Syntax
13
13
14
14
> ALIGN [[*number*]]
15
15
16
+
## Remarks
17
+
18
+
The **ALIGN** directive allows you to specify the beginning offset of a data element or an instruction. Aligned data can improve performance, at the expense of wasted space between data elements. Large performance improvements can be seen when data accesses are on boundaries that fit within cache lines. Accesses on natural boundaries for native types means less time spent in internal hardware realignment microcode.
19
+
20
+
The need for aligned instructions is rare on modern processors that use a flat addressing model, but may be required for jump targets in older code for other addressing models.
21
+
22
+
When data is aligned, the skipped space is padded with zeroes. When instructions are aligned, the skipped space is filled with appropriately-sized NOP instructions.
Copy file name to clipboardExpand all lines: docs/build/exporting-from-a-dll-using-def-files.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
2
title: "Exporting from a DLL Using DEF Files"
3
-
ms.date: "11/04/2016"
3
+
ms.date: "01/09/2018"
4
4
helpviewer_keywords: ["def files [C++], exporting from DLLs", ".def files [C++], exporting from DLLs", "exporting DLLs [C++], DEF files"]
5
5
ms.assetid: 9d31eda2-184e-47de-a2ee-a93ebd603f8e
6
6
---
7
7
# Exporting from a DLL Using DEF Files
8
8
9
-
A module-definition (.def) file is a text file containing one or more module statements that describe various attributes of a DLL. If you are not using the **__declspec(dllexport)** keyword to export the DLL's functions, the DLL requires a .def file.
9
+
A module-definition or DEF file (*.def) is a text file containing one or more module statements that describe various attributes of a DLL. If you are not using the **__declspec(dllexport)** keyword to export the DLL's functions, the DLL requires a DEF file.
10
10
11
-
A minimal .def file must contain the following module-definition statements:
11
+
A minimal DEF file must contain the following module-definition statements:
12
12
13
-
- The first statement in the file must be the LIBRARY statement. This statement identifies the .def file as belonging to a DLL. The LIBRARY statement is followed by the name of the DLL. The linker places this name in the DLL's import library.
13
+
- The first statement in the file must be the LIBRARY statement. This statement identifies the DEF file as belonging to a DLL. The LIBRARY statement is followed by the name of the DLL. The linker places this name in the DLL's import library.
14
14
15
15
- The EXPORTS statement lists the names and, optionally, the ordinal values of the functions exported by the DLL. You assign the function an ordinal value by following the function's name with an at sign (@) and a number. When you specify ordinal values, they must be in the range 1 through N, where N is the number of functions exported by the DLL. If you want to export functions by ordinal, see [Exporting Functions from a DLL by Ordinal Rather Than by Name](../build/exporting-functions-from-a-dll-by-ordinal-rather-than-by-name.md) as well as this topic.
16
16
@@ -25,11 +25,11 @@ EXPORTS
25
25
Min @4
26
26
```
27
27
28
-
If you use the [MFC DLL Wizard](../mfc/reference/mfc-dll-wizard.md) to create an MFC DLL, the wizard creates a skeleton .def file for you and automatically adds it to your project. Add the names of the functions to be exported to this file. For non-MFC DLLs, you must create the .def file yourself and add it to your project.
28
+
If you use the [MFC DLL Wizard](../mfc/reference/mfc-dll-wizard.md) to create an MFC DLL, the wizard creates a skeleton DEF file for you and automatically adds it to your project. Add the names of the functions to be exported to this file. For non-MFC DLLs, create the DEF file yourself and add it to your project. Then go to **Project** > **Properties** > **Linker** > **Input** > **Module Definition File** and enter the name of the DEF file. Repeat this step for each configuration and platform, or do it all at once by selecting **Configuration = All Configurations**, and **Platform = All Platforms**.
29
29
30
-
If you are exporting functions in a C++ file, you have to either place the decorated names in the .def file or define your exported functions with standard C linkage by using extern "C". If you need to place the decorated names in the .def file, you can obtain them by using the [DUMPBIN](../build/reference/dumpbin-reference.md) tool or by using the linker [/MAP](../build/reference/map-generate-mapfile.md) option. Note that the decorated names produced by the compiler are compiler specific. If you place the decorated names produced by the Visual C++ compiler into a .def file, applications that link to your DLL must also be built using the same version of Visual C++ so that the decorated names in the calling application match the exported names in the DLL's .def file.
30
+
If you are exporting functions in a C++ file, you have to either place the decorated names in the DEF file or define your exported functions with standard C linkage by using extern "C". If you need to place the decorated names in the DEF file, you can obtain them by using the [DUMPBIN](../build/reference/dumpbin-reference.md) tool or by using the linker [/MAP](../build/reference/map-generate-mapfile.md) option. Note that the decorated names produced by the compiler are compiler specific. If you place the decorated names produced by the Visual C++ compiler into a DEF file, applications that link to your DLL must also be built using the same version of Visual C++ so that the decorated names in the calling application match the exported names in the DLL's DEF file.
31
31
32
-
If you are building an [extension DLL](../build/extension-dlls-overview.md), and exporting using a .def file, place the following code at the beginning and end of your header files that contain the exported classes:
32
+
If you are building an [extension DLL](../build/extension-dlls-overview.md), and exporting using a DEF file, place the following code at the beginning and end of your header files that contain the exported classes:
33
33
34
34
```
35
35
#undef AFX_DATA
@@ -41,9 +41,9 @@ If you are building an [extension DLL](../build/extension-dlls-overview.md), and
41
41
42
42
These lines ensure that MFC variables that are used internally or that are added to your classes are exported (or imported) from your MFC extension DLL. For example, when deriving a class using `DECLARE_DYNAMIC`, the macro expands to add a `CRuntimeClass` member variable to your class. Leaving out these four lines might cause your DLL to compile or link incorrectly or cause an error when the client application links to the DLL.
43
43
44
-
When building the DLL, the linker uses the .def file to create an export (.exp) file and an import library (.lib) file. The linker then uses the export file to build the DLL file. Executables that implicitly link to the DLL link to the import library when they are built.
44
+
When building the DLL, the linker uses the DEF file to create an export (.exp) file and an import library (.lib) file. The linker then uses the export file to build the DLL file. Executables that implicitly link to the DLL link to the import library when they are built.
45
45
46
-
Note that MFC itself uses .def files to export functions and classes from the MFCx0.dll.
46
+
Note that MFC itself uses DEF files to export functions and classes from the MFCx0.dll.
Copy file name to clipboardExpand all lines: docs/build/reference/optimization-best-practices.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ The **/Gy** switch is also very useful. It generates a separate COMDAT for each
26
26
27
27
For linking in 64-bit environments, it is recommended to use the **/OPT:REF,ICF** linker option, and in 32-bit environments, **/OPT:REF** is recommended. For more information, see [/OPT (Optimizations)](../../build/reference/opt-optimizations.md).
28
28
29
-
It is also strongly recommended to generate debug symbols, even with optimized release builds. It doesn’t effect the generated code, and it makes it a lot easier to debug your application, if need be.
29
+
It is also strongly recommended to generate debug symbols, even with optimized release builds. It doesn’t affect the generated code, and it makes it a lot easier to debug your application, if need be.
Specifies a SourceLink configuration file to include in the PDB file generated by the linker.
9
+
Specifies a Source Link configuration file to include in the PDB file generated by the linker.
10
10
11
11
## Syntax
12
12
@@ -19,7 +19,7 @@ Specifies a JSON-formatted configuration file that contains a simple mapping of
19
19
20
20
## Remarks
21
21
22
-
SourceLink is a language- and source-control agnostic system for providing source debugging for binaries. SourceLink is supported for native C++ binaries starting in Visual Studio 2017 version 15.8. For an overview of SourceLink, see [Source Link](https://github.com/dotnet/designs/blob/master/accepted/diagnostics/source-link.md). For information on how to use SourceLink in your projects and how to generate the SourceLink file as part of your project, see [Using SourceLink](https://github.com/dotnet/sourcelink#using-sourcelink).
22
+
Source Link is a language- and source-control agnostic system for providing source debugging for binaries. Source Link is supported for native C++ binaries starting in Visual Studio 2017 version 15.8. For an overview of Source Link, see [Source Link](https://github.com/dotnet/designs/blob/master/accepted/diagnostics/source-link.md). For information on how to use Source Link in your projects and how to generate the SourceLink file as part of your project, see [Using Source Link](https://github.com/dotnet/sourcelink#using-source-link-in-c-projects).
23
23
24
24
### To set the /SOURCELINK linker option in Visual Studio
Copy file name to clipboardExpand all lines: docs/c-language/c-floating-point-constants.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ You can omit either the digits before the decimal point (the integer portion of
36
36
37
37
The following examples illustrate some forms of floating-point constants and expressions:
38
38
39
-
```
39
+
```C
40
40
15.75
41
41
1.575E1/* = 15.75 */
42
42
1575e-2/* = 15.75 */
@@ -48,16 +48,16 @@ Floating-point constants are positive unless they are preceded by a minus sign (
48
48
49
49
A floating-point constant without an **f**, **F**, **l**, or **L** suffix has type `double`. If the letter **f** or **F** is the suffix, the constant has type `float`. If suffixed by the letter **l** or **L**, it has type `long double`. For example:
50
50
51
-
```
52
-
100L /* Has type long double */
53
-
100F /* Has type float */
51
+
```C
52
+
10.0L/* Has type long double */
53
+
10.0F/* Has type float */
54
54
```
55
55
56
56
Note that the Microsoft C compiler internally represents `long double` the same as type `double`. See [Storage of Basic Types](../c-language/storage-of-basic-types.md) for information about type `double`, `float`, and `long double`.
57
57
58
58
You can omit the integer portion of the floating-point constant, as shown in the following examples. The number .75 can be expressed in many ways, including the following:
0 commit comments