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/calling-dll-functions-from-visual-basic-applications.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ For Visual Basic applications (or applications in other languages such as Pascal
17
17
18
18
`__stdcall` creates the correct calling convention for the function (the called function cleans up the stack and parameters are passed from right to left) but decorates the function name differently. So, when **__declspec(dllexport)** is used on an exported function in a DLL, the decorated name is exported.
19
19
20
-
The `__stdcall` name decoration prefixes the symbol name with an underscore (_) and appends the symbol with an at sign (**\@**) character followed by the number of bytes in the argument list (the required stack space). As a result, the function when declared as:
20
+
The `__stdcall` name decoration prefixes the symbol name with an underscore (**\_**) and appends the symbol with an at sign (**\@**) character followed by the number of bytes in the argument list (the required stack space). As a result, the function when declared as:
21
21
22
22
```C
23
23
int __stdcall func (int a, double b)
@@ -29,7 +29,7 @@ The C calling convention (`__cdecl`) decorates the name as `_func`.
29
29
30
30
To get the decorated name, use [/MAP](../build/reference/map-generate-mapfile.md). Use of **__declspec(dllexport)** does the following:
31
31
32
-
- If the function is exported with the C calling convention (**_cdecl**), it strips the leading underscore (_) when the name is exported.
32
+
- If the function is exported with the C calling convention (`__cdecl`), it strips the leading underscore ( **\_** ) when the name is exported.
33
33
34
34
- If the function being exported does not use the C calling convention (for example, `__stdcall`), it exports the decorated name.
Copy file name to clipboardExpand all lines: docs/build/reference/gh-enable-penter-hook-function.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ The `_penter` function is not part of any library and it is up to you to provide
29
29
Unless you plan to explicitly call `_penter`, you do not need to provide a prototype. The function must appear as if it had the following prototype, and it must push the content of all registers on entry and pop the unchanged content on exit:
30
30
31
31
```
32
-
void __declspec(naked) _cdecl _penter( void );
32
+
void __declspec(naked) __cdecl _penter( void );
33
33
```
34
34
35
35
This declaration is not available for 64-bit projects.
@@ -52,7 +52,7 @@ This declaration is not available for 64-bit projects.
52
52
53
53
The following code, when compiled with **/Gh**, shows how `_penter` is called twice; once when entering function `main` and once when entering function `x`.
Copy file name to clipboardExpand all lines: docs/build/reference/gh-enable-pexit-hook-function.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ The `_pexit` function is not part of any library and it is up to you to provide
29
29
Unless you plan to explicitly call `_pexit`, you do not need to provide a prototype. The function must appear as if it had the following prototype, and it must push the content of all registers on entry and pop the unchanged content on exit:
30
30
31
31
```
32
-
void __declspec(naked) _cdecl _pexit( void );
32
+
void __declspec(naked) __cdecl _pexit( void );
33
33
```
34
34
35
35
`_pexit` is similar to `_penter`; see [/Gh (Enable _penter Hook Function)](../../build/reference/gh-enable-penter-hook-function.md) for an example of how to write a `_pexit` function.
<sup>1</sup> The **__based** keyword has limited uses for 32-bit and 64-bit target compilations.
46
46
47
47
<sup>2</sup> These are special identifiers when used with **__declspec**; their use in other contexts is not restricted.
48
48
49
-
Microsoft extensions are enabled by default. To ensure that your programs are fully portable, you can disable Microsoft extensions by specifying the /Za option (compile for ANSI compatibility) during compilation. When you do this, Microsoft-specific keywords are disabled.
49
+
<sup>3</sup> For compatibility with previous versions, these keywords are available both with two leading underscores and a single leading underscore when Microsoft extensions are enabled.
50
+
51
+
Microsoft extensions are enabled by default. To ensure that your programs are fully portable, you can disable Microsoft extensions by specifying the [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) option during compilation. When you do this, some Microsoft-specific keywords are disabled.
50
52
51
53
When Microsoft extensions are enabled, you can use the keywords listed above in your programs. For ANSI compliance, most of these keywords are prefaced by a double underscore. The four exceptions, **dllexport**, **dllimport**, **naked**, and **thread**, are used only with **__declspec** and therefore do not require a leading double underscore. For backward compatibility, single-underscore versions of the rest of the keywords are supported.
For compatibility with previous versions, **_cdecl** is a synonym for **__cdecl** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
56
+
55
57
## Example
56
58
57
59
In the following example, the compiler is instructed to use C naming and calling conventions for the `system` function.
Copy file name to clipboardExpand all lines: docs/cpp/inline-functions-cpp.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ Using inline functions can make your program faster because they eliminate the o
71
71
72
72
The compiler treats the inline expansion options and keywords as suggestions. There is no guarantee that functions will be inlined. You cannot force the compiler to inline a particular function, even with the **__forceinline** keyword. When compiling with **/clr**, the compiler will not inline a function if there are security attributes applied to the function.
73
73
74
-
The **inline** keyword is available only in C++. The **__inline** and **__forceinline** keywords are available in both C and C++. For compatibility with previous versions, **_inline** is a synonym for **__inline**.
74
+
The **inline** keyword is available only in C++. The **__inline** and **__forceinline** keywords are available in both C and C++. For compatibility with previous versions, **_inline** is a synonym for **__inline** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
75
75
76
76
The **inline** keyword tells the compiler that inline expansion is preferred. However, the compiler can create a separate instance of the function (instantiate) and create standard calling linkages instead of inserting the code inline. Two cases where this can happen are:
<sup>1</sup> Extended attributes for the **__declspec** keyword.
61
64
62
-
1 Extended attributes for the **__declspec** keyword.
65
+
<sup>2</sup> Applicable to Managed Extensions for C++ only. This syntax is now deprecated. See [Component Extensions for Runtime Platforms](../windows/component-extensions-for-runtime-platforms.md) for more information.
63
66
64
-
2 Applicable to Managed Extensions for C++ only. This syntax is now deprecated.
65
67
66
-
3 Intrinsic function used in event handling.
67
68
68
-
See [Component Extensions for Runtime Platforms](../windows/component-extensions-for-runtime-platforms.md) for more information.
69
+
<sup>3</sup> Intrinsic function used in event handling.
69
70
70
-
## Microsoft Specific
71
+
<sup>4</sup> For backward compatibility with previous versions, these keywords are available both with two leading underscores and a single leading underscore when Microsoft extensions are enabled (the default).
72
+
73
+
**Microsoft Specific**
71
74
72
75
In Microsoft C++, identifiers with two leading underscores are reserved for compiler implementations. Therefore, the Microsoft convention is to precede Microsoft-specific keywords with double underscores. These words cannot be used as identifier names.
73
76
74
-
Microsoft extensions are enabled by default. To ensure that your programs are fully portable, you can disable Microsoft extensions by specifying the ANSI-compatible [/Za](../build/reference/za-ze-disable-language-extensions.md)command-line option (compile for ANSI compatibility) during compilation. When you do this, Microsoft-specific keywords are disabled.
77
+
Microsoft extensions are enabled by default. To ensure that your programs are fully portable, you can disable Microsoft extensions by specifying the [/Za\(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) option during compilation. When you do this, some Microsoft-specific keywords are disabled.
75
78
76
-
When Microsoft extensions are enabled, you can use the Microsoft-specific keywords in your programs. For ANSI compliance, these keywords are prefaced by a double underscore. For backward compatibility, single-underscore versions of all the double-underscored keywords except **__except**, **__finally**, **__leave**, and **__try** are supported. In addition, **__cdecl** is available with no leading underscore.
79
+
When Microsoft extensions are enabled, you can use the Microsoft-specific keywords in your programs. For ANSI compliance, these keywords are prefaced by a double underscore. For backward compatibility, single-underscore versions of many of the double-underscored keywords are supported. In addition, **__cdecl** is available with no leading underscore.
77
80
78
81
The **__asm** keyword replaces C++ `asm` syntax. `asm` is reserved for compatibility with other C++ implementations, but not implemented. Use **__asm**.
0 commit comments