Skip to content

Repo sync for protected CLA branch #4182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/build/reference/cetcompat.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
description: "Learn more about: /CETCOMPAT (CET Shadow Stack compatible)"
title: "/CETCOMPAT (CET Shadow Stack compatible)"
ms.date: 09/22/2021
f1_keywords: ["/CETCOMPAT"]
f1_keywords: ["VC.Project.VCLinkerTool.CETCompat", "/CETCOMPAT"]
helpviewer_keywords: ["/CETCOMPAT linker option", "/CETCOMPAT"]
---
# /CETCOMPAT (CET Shadow Stack compatible)
# `/CETCOMPAT` (CET Shadow Stack compatible)

Specifies whether to mark an executable image as compatible with Control-flow Enforcement Technology (CET) Shadow Stack.
Specifies whether the linker marks an executable image as compatible with Control-flow Enforcement Technology (CET) Shadow Stack.

## Syntax

Expand All @@ -21,7 +21,7 @@ Specifies that the executable shouldn't be marked compatible with CET Shadow Sta

## Remarks

Control-flow Enforcement Technology (CET) Shadow Stack is a computer processor feature. It provides capabilities to defend against return-oriented programming (ROP) based malware attacks. For more information, see [A Technical Look at Intels Control-flow Enforcement Technology](https://software.intel.com/content/www/us/en/develop/articles/technical-look-control-flow-enforcement-technology.html).
Control-flow Enforcement Technology (CET) Shadow Stack is a computer processor feature. It provides capabilities to defend against return-oriented programming (ROP) based malware attacks. For more information, see [A Technical Look at Intel's Control-flow Enforcement Technology](https://software.intel.com/content/www/us/en/develop/articles/technical-look-control-flow-enforcement-technology.html).

The **`/CETCOMPAT`** linker option tells the linker to mark the binary as CET Shadow Stack-compatible. **`/CETCOMPAT:NO`** marks the binary as not compatible with CET Shadow Stack. If both options are specified on the command line, the last one specified is used. This switch is currently only applicable to x86 and x64 architectures.

Expand All @@ -31,7 +31,7 @@ The **`/CETCOMPAT`** option is available beginning in Visual Studio 2019.

Starting in Visual Studio 2019 version 16.7:

1. Open the **Property Pages** dialog box for the project. For more information, see [Working with Project Properties](../working-with-project-properties.md).
1. Open the **Property Pages** dialog box for the project. For more information, see [Set compiler and build properties](../working-with-project-properties.md).

1. Select the **Configuration Properties** > **Linker** > **Advanced** property page.

Expand All @@ -41,7 +41,7 @@ Starting in Visual Studio 2019 version 16.7:

In previous versions of Visual Studio 2019:

1. Open the **Property Pages** dialog box for the project. For more information, see [Working with Project Properties](../working-with-project-properties.md).
1. Open the **Property Pages** dialog box for the project. For more information, see [Set compiler and build properties](../working-with-project-properties.md).

1. Select the **Configuration Properties** > **Linker** > **Command Line** property page.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
---
description: "Learn more about: /CLRSUPPORTLASTERROR (Preserve Last Error Code for PInvoke Calls)"
title: "/CLRSUPPORTLASTERROR (Preserve Last Error Code for PInvoke Calls)"
ms.date: "11/04/2016"
f1_keywords: ["/CLRSUPPORTLASTERROR"]
ms.date: 09/19/2022
f1_keywords: ["VC.Project.VCLinkerTool.CLRSupportLastError", "/CLRSUPPORTLASTERROR"]
helpviewer_keywords: ["/CLRSUPPORTLASTERROR linker option", "-CLRSUPPORTLASTERROR linker option"]
ms.assetid: b7057990-4154-4b1d-9fc9-6236f7be7575
---
# /CLRSUPPORTLASTERROR (Preserve Last Error Code for PInvoke Calls)
# `/CLRSUPPORTLASTERROR` (Preserve Last Error Code for PInvoke Calls)

**/CLRSUPPORTLASTERROR**, which is on by default, preserves the last error code of functions called through the P/Invoke mechanism, which allows you to call native functions in DLLS, from code compiled with **/clr**.
**`/CLRSUPPORTLASTERROR`**, which is on by default, preserves the last error code of functions called through the P/Invoke mechanism, which allows you to call native functions in DLLS, from code compiled with **`/clr`**.

## Syntax

```
/CLRSUPPORTLASTERROR{:NO | SYSTEMDLL}
```
> **`/CLRSUPPORTLASTERROR`**\
> **`/CLRSUPPORTLASTERROR:NO`**\
> **`/CLRSUPPORTLASTERROR:SYSTEMDLL`**

## Remarks

Preserving the last error code implies a decrease in performance. If you do not want to incur the performance impact of preserving the last error code, link with **/CLRSUPPORTLASTERROR:NO**.
Preserving the last error code implies a decrease in performance. If you don't want to incur the performance cost of preserving the last error code, link by using **`/CLRSUPPORTLASTERROR:NO`**.

You can minimize the performance impact by linking with **/CLRSUPPORTLASTERROR:SYSTEMDLL**, which only preserves the last error code for functions in system DLLs.
You can minimize the performance penalty by linking with **`/CLRSUPPORTLASTERROR:SYSTEMDLL`**, which only preserves the last error code for functions in system DLLs.

> [!NOTE]
> Preserving the last error is not supported for unmanaged functions that are consumed by CLR code, in the same module.
> Preserving the last error isn't supported for unmanaged functions that are consumed by CLR code in the same module.

- For more information, see [/clr (Common Language Runtime Compilation)](clr-common-language-runtime-compilation.md).
- For more information, see [`/clr` (Common Language Runtime Compilation)](clr-common-language-runtime-compilation.md).

### To set this linker option in the Visual Studio development environment

1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
1. Open the **Property Pages** dialog box for the project. For more information, see [Set compiler and build properties](../working-with-project-properties.md).

1. Select the **Configuration Properties** > **Linker** > **Command Line** property page.
1. Select the **Configuration Properties** > **Linker** > **Advanced** property page.

1. Enter the option into the **Additional Options** box.
1. Modify the **Preserve Last Error Code for PInvoke Calls** property. Choose **OK** or **Apply** to save your changes.

### To set this linker option programmatically

Expand All @@ -56,7 +56,7 @@ __declspec(dllexport) double MySqrt(__int64 n) {
}
```

The following sample consumes the DLL, demonstrating how to use **/CLRSUPPORTLASTERROR**.
The following sample consumes the DLL, demonstrating how to use **`/CLRSUPPORTLASTERROR`**.

```cpp
// CLRSUPPORTLASTERROR_client.cpp
Expand Down Expand Up @@ -109,5 +109,5 @@ GetLastError for system call succeeded (183).

## See also

[MSVC linker reference](linking.md)<br/>
[MSVC Linker Options](linker-options.md)
[MSVC linker reference](linking.md)\
[MSVC linker options](linker-options.md)
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
---
description: "Learn more about: /CLRUNMANAGEDCODECHECK (Remove SuppressUnmanagedCodeSecurityAttribute)"
title: "/CLRUNMANAGEDCODECHECK (Remove SuppressUnmanagedCodeSecurityAttribute)"
ms.date: "05/16/2019"
ms.date: 09/19/2022
ms.topic: "reference"
f1_keywords: ["/CLRUNMANAGEDCODECHECK"]
f1_keywords: ["VC.Project.VCLinkerTool.CLRUnmanagedCodeCheck", "/CLRUNMANAGEDCODECHECK"]
helpviewer_keywords: ["-CLRUNMANAGEDCODECHECK linker option", "/CLRUNMANAGEDCODECHECK linker option"]
ms.assetid: 73abc426-dab0-45e2-be85-0f9a14206cc2
author: "corob-msft"
ms.author: "corob"
---
# /CLRUNMANAGEDCODECHECK (Remove SuppressUnmanagedCodeSecurityAttribute)
# `/CLRUNMANAGEDCODECHECK` (Remove SuppressUnmanagedCodeSecurityAttribute)

**/CLRUNMANAGEDCODECHECK** specifies that the linker does not apply <xref:System.Security.SuppressUnmanagedCodeSecurityAttribute> to linker-generated `PInvoke` calls from managed code into native DLLs.
**`/CLRUNMANAGEDCODECHECK`** specifies that the linker doesn't apply <xref:System.Security.SuppressUnmanagedCodeSecurityAttribute> to linker-generated `PInvoke` calls from managed code into native DLLs.

## Syntax

> **/CLRUNMANAGEDCODECHECK**[**:NO**]
> **`/CLRUNMANAGEDCODECHECK`**\
> **`/CLRUNMANAGEDCODECHECK:NO`**

## Remarks

By default, the linker applies the **SuppressUnmanagedCodeSecurityAttribute** to linker-generated `PInvoke` calls. When **/CLRUNMANAGEDCODECHECK** is in effect, **SuppressUnmanagedCodeSecurityAttribute** is removed. To explicitly apply the **SuppressUnmanagedCodeSecurityAttribute** to linker-generated `PInvoke` calls, you can use **/CLRUNMANAGEDCODECHECK:NO**.
By default, the linker applies the `SuppressUnmanagedCodeSecurityAttribute` attribute to linker-generated `PInvoke` calls. When **`/CLRUNMANAGEDCODECHECK`** is in effect, `SuppressUnmanagedCodeSecurityAttribute` is removed. To explicitly apply the `SuppressUnmanagedCodeSecurityAttribute` attribute to linker-generated `PInvoke` calls, you can use **`/CLRUNMANAGEDCODECHECK:NO`**.

The linker only adds the attribute to objects that are compiled using **/clr** or **/clr:pure**. However, the **/clr:pure** compiler option is deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017 and later.
The linker only adds the attribute to objects that are compiled using **`/clr`** or **`/clr:pure`**. However, the **`/clr:pure`** compiler option is deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017 and later.

A `PInvoke` call is generated by the linker when the linker cannot find a managed symbol to satisfy a reference from a managed caller but can find a native symbol to satisfy that reference. For more information about `PInvoke`, see [Calling Native Functions from Managed Code](../../dotnet/calling-native-functions-from-managed-code.md).
A `PInvoke` call is generated by the linker when the linker can't find a managed symbol to satisfy a reference from a managed caller but can find a native symbol to satisfy that reference. For more information about `PInvoke`, see [Calling Native Functions from Managed Code](../../dotnet/calling-native-functions-from-managed-code.md).

Note that if you use <xref:System.Security.AllowPartiallyTrustedCallersAttribute> in your code, you should explicitly set **/CLRUNMANAGEDCODECHECK** to remove the **SuppressUnmanagedCodeSecurity** attribute. It is a potential security vulnerability if an image contains both the **SuppressUnmanagedCodeSecurity** and **AllowPartiallyTrustedCallers** attributes.
If you use <xref:System.Security.AllowPartiallyTrustedCallersAttribute> in your code, you should explicitly set **`/CLRUNMANAGEDCODECHECK`** to remove the `SuppressUnmanagedCodeSecurity` attribute. It's a potential security vulnerability if an image contains both the `SuppressUnmanagedCodeSecurity` and `AllowPartiallyTrustedCallers` attributes.

See [Secure Coding Guidelines for Unmanaged Code](/previous-versions/dotnet/framework/windows-identity-foundation/secure-coding-guidelines-for-unmanaged-code) for more information about the implications of using **SuppressUnmanagedCodeSecurityAttribute**.
For more information about the implications of using `SuppressUnmanagedCodeSecurityAttribute`, see [Secure Coding Guidelines for Unmanaged Code](/previous-versions/dotnet/framework/windows-identity-foundation/secure-coding-guidelines-for-unmanaged-code).

### To set this linker option in the Visual Studio development environment

1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
1. Open the **Property Pages** dialog box for the project. For more information, see [Set compiler and build properties](../working-with-project-properties.md).

1. Select the **Configuration Properties** > **Linker** > **Advanced** property page.

Expand All @@ -43,5 +44,5 @@ See [Secure Coding Guidelines for Unmanaged Code](/previous-versions/dotnet/fram

## See also

- [MSVC linker reference](linking.md)
- [MSVC Linker Options](linker-options.md)
[MSVC linker reference](linking.md)\
[MSVC linker options](linker-options.md)
31 changes: 22 additions & 9 deletions docs/build/reference/command-line-property-pages.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
---
description: "Learn more about: Command Line Property Pages"
title: "Command Line Property Pages"
ms.date: "11/04/2016"
description: "Learn more about: Command line property pages"
title: "Command line property pages"
ms.date: 09/21/2022
f1_keywords: ["vc.project.AdditionalOptionsPage", "vc.project.CommandLinePage"]
helpviewer_keywords: ["Command Line property pages"]
ms.assetid: e1721b6c-8b39-4b44-a41e-69b5bb470cc9
---
# Command Line Property Pages
# Command line property pages

Most property page folders contain a **Command Line** property page. This page displays which properties are set in the folder. The **Command Line** property page also contains an **Additional Options** box where you can specify properties that are valid for the tool but for which there is no property in the folder.
Most property page folders that correspond with a command-line tool contain a **Command Line** property page. For information on how to access the **Command Line** property pages, see [Set compiler and build properties](../working-with-project-properties.md).

Any command that you enter in the edit box will be passed through to the tool for the folder. No verification or checks will be done on the input, nor will there be any dependency checking.
## Command Line property page

For information on how to access the **Command Line** property pages, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
### All Options

The **All Options** display-only control shows the tool command line created by the properties set in the folder.

### Additional Options

This property's edit control lets you specify other command-line options that are valid for the tool but that don't have a corresponding property.

The options that you enter in the edit box are passed through to the tool for the folder after the options listed in **All Options**. No verification or validity checks are done on the options you enter, and there's no dependency checking.

## See also

[C++ project property page reference](property-pages-visual-cpp.md)<br>
[.Lib Files as Linker Input](dot-lib-files-as-linker-input.md)
[Windows C++ project property page reference](property-pages-visual-cpp.md)\
[Linux C++ property page reference](../../linux/prop-pages-linux.md)\
[Linker property pages](./linker-property-pages.md)\
[Manifest tool property pages](manifest-tool-property-pages.md)\
[MIDL property pages](midl-property-pages.md)\
[NMake property page](nmake-property-page.md)\
[XML document generator tool property pages](xml-document-generator-tool-property-pages.md)
36 changes: 18 additions & 18 deletions docs/build/reference/def-specify-module-definition-file.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
---
description: "Learn more about: /DEF (Specify Module-Definition File)"
title: "/DEF (Specify Module-Definition File)"
ms.date: "11/04/2016"
description: "Learn more about: /DEF (Specify module-definition file)"
title: "/DEF (Specify module-definition file)"
ms.date: 09/09/2022
f1_keywords: ["VC.Project.VCLinkerTool.ModuleDefinitionFile", "/def"]
helpviewer_keywords: ["module definition files, specifying", "DEF linker option", "-DEF linker option", "module definition files", "/DEF linker option"]
ms.assetid: 6497fa68-65f0-48ca-8f66-b87166fc631a
---
# /DEF (Specify Module-Definition File)
# `/DEF` (Specify module-definition file)

```
/DEF:filename
```
Specifies a module-definition file to the linker.

## Syntax

> **`/DEF:`***`filename`*

## Arguments

*filename*<br/>
The name of a module-definition file (.def) to be passed to the linker.
*`filename`*\
The name of a module-definition file (*`.def`*) to be passed to the linker.

## Remarks

The /DEF option passes a module-definition file (.def) to the linker. Only one .def file can be specified to LINK. For details about .def files, see [Module-Definition Files](module-definition-dot-def-files.md).
The **`/DEF`** linker option passes a module-definition file (*`.def`*) to the linker. Only one *`.def`* file can be specified to LINK. For details about *`.def`* files, see [Module-definition files](module-definition-dot-def-files.md).

### To set this linker option in the Visual Studio development environment
To specify a *`.def`* file from within the development environment, add it to the project along with your other source files and then specify the file in the project's **Property Pages** dialog.

1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).

1. Click the **Linker** folder.
### To set this linker option in the Visual Studio development environment

1. Click the **Input** property page.
1. Open the project's **Property Pages** dialog box. For more information, see [Set compiler and build properties](../working-with-project-properties.md).

1. Modify the **Module Definition File** property.
1. Select the **Configuration Properties** > **Linker** > **Input** property page.

To specify a .def file from within the development environment, you should add it to the project along with other files and then specify the file to the /DEF option.
1. Modify the **Module Definition File** property. Choose **OK** or **Apply** to save your changes.

### To set this linker option programmatically

- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.ModuleDefinitionFile%2A>.

## See also

[MSVC linker reference](linking.md)<br/>
[MSVC linker reference](linking.md)\
[MSVC Linker Options](linker-options.md)
10 changes: 5 additions & 5 deletions docs/build/reference/delay-delay-load-import-settings.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
description: "Learn more about: /DELAY (Delay load import settings)"
title: "/DELAY (Delay load import settings)"
ms.date: 01/28/2021
f1_keywords: ["/delay", "VC.Project.VCLinkerTool.DelayNoBind", "VC.Project.VCLinkerTool.SupportUnloadOfDelayLoadedDLL", "VC.Project.VCLinkerTool.DelayUnload"]
ms.date: 09/19/2022
f1_keywords: ["/delay", "VC.Project.VCLinkerTool.DelayNoBind", "VC.Project.VCLinkerTool.SupportUnloadOfDelayLoadedDLL", "VC.Project.VCLinkerTool.DelayUnload", "VC.Project.VCLinkerTool.SupportNobindOfDelayLoadedDLL"]
helpviewer_keywords: ["delayed loading of DLLs, /DELAY option", "DELAY linker option", "/DELAY linker option", "-DELAY linker option"]
---
# `/DELAY` (Delay load import settings)
Expand Down Expand Up @@ -32,15 +32,15 @@ To specify DLLs to delay load, use the [`/DELAYLOAD`](delayload-delay-load-impor

### To set this linker option in the Visual Studio development environment

1. Open the project's **Property Pages** dialog box. For information, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
1. Open the **Property Pages** dialog box for the project. For more information, see [Set compiler and build properties](../working-with-project-properties.md).

1. Select the **Configuration Properties** > **Linker** > **Advanced** property page.

1. Modify the **Delay Loaded DLL** property. Choose **OK** to save your changes.
1. Modify the **Unload delay loaded DLL** property or the **Unbind delay loaded DLL** property. Choose **OK** or **Apply** to save your changes.

### To set this linker option programmatically

- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.DelayLoadDLLs%2A>.
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions%2A>.

## See also

Expand Down
Loading