Skip to content

Commit 8953e3b

Browse files
author
Colin Robertson
committed
Update for some issues in CRT and build docs.
1 parent a937c9d commit 8953e3b

8 files changed

Lines changed: 35 additions & 57 deletions

docs/assembler/masm/masm-for-x64-ml64-exe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ translation.priority.ht:
3434
- "zh-tw"
3535
---
3636
# MASM for x64 (ml64.exe)
37-
ml64.exe is the assembler that accepts [!INCLUDE[vcprx64](../../assembler/inline/includes/vcprx64_md.md)] assembly language. For information on ml64.exe compiler options, see [ML and ML64 Command-Line Reference](../../assembler/masm/ml-and-ml64-command-line-reference.md).
37+
ml64.exe is the assembler that accepts x64 assembly language. For information on ml64.exe compiler options, see [ML and ML64 Command-Line Reference](../../assembler/masm/ml-and-ml64-command-line-reference.md).
3838

39-
Inline ASM is not supported for [!INCLUDE[vcprx64](../../assembler/inline/includes/vcprx64_md.md)]. Use MASM or compiler intrinsics ([x64 Intrinsics](http://msdn.microsoft.com/en-us/5d1f5d3e-156e-4ebf-932e-fd09be7ced62)).
39+
Inline ASM is not supported for x64. Use MASM or compiler intrinsics ([x64 (amd64) Intrinsics List](../../intrinsics/x64-amd64-intrinsics-list.md)).
4040

4141
The two workarounds are separate assembly with MASM (which supports x64 fully) and compiler intrinsics. We’ve added a lot of intrinsics to allow customers to make use of special-function instructions (e.g. privileged, bit scan/test, interlocked, etc…) in as close to cross-platform a manner as possible.
4242

docs/build/configuring-programs-for-64-bit-visual-cpp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ This section contains topics about targeting 64-bit hardware with the Visual C++
5454

5555
[align](../cpp/align-cpp.md)
5656

57-
[/clr (Common Language Runtime Compilation)](../build/reference/clr-common-language-runtime-compilation.md) for information on how to run an application compiled with **/clr:safe** under WOW64 on a 64-bit operating system.
57+
[/clr (Common Language Runtime Compilation)](../build/reference/clr-common-language-runtime-compilation.md)
5858

5959
[/favor (Optimize for Architecture Specifics)](../build/reference/favor-optimize-for-architecture-specifics.md)
6060

6161
[Programming Guide for 64-bit Windows](http://msdn.microsoft.com/library/windows/desktop/bb427430)
6262

6363
[MASM for x64 (ml64.exe)](../assembler/masm/masm-for-x64-ml64-exe.md)
6464

65-
[x64 Intrinsics](http://msdn.microsoft.com/en-us/5d1f5d3e-156e-4ebf-932e-fd09be7ced62)
65+
[x64 (amd64) Intrinsics List](../intrinsics/x64-amd64-intrinsics-list.md)
6666

6767
## See Also
68-
[(NOTINBUILD)Visual C++ Programming Methodologies](http://msdn.microsoft.com/en-us/0822f806-fa81-4b65-bf0f-1e2921f30c95)
68+
[Building C/C++ Programs](building-c-cpp-programs.md)

docs/c-runtime-library/link-options.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ The CRT lib directory includes a number of small object files that enable specif
7777
|noenv.obj|pnoenv.obj|Disables the creation of a cached environment for the CRT.|
7878
|nothrownew.obj|pnothrownew.obj|Enables the non-throwing version of new in the CRT. See [new and delete Operators](../cpp/new-and-delete-operators.md).|
7979
|setargv.obj|psetargv.obj|Enables command-line argument wildcard expansion. See [Expanding Wildcard Arguments](../c-language/expanding-wildcard-arguments.md).|
80-
|smalheap.obj|n/a|Installs a very simple small heap manager.|
8180
|threadlocale.obj|pthreadlocale.obj|Enables per-thread locale for all new threads by default.|
8281
|wsetargv.obj|pwsetargv.obj|Enables command-line argument wildcard expansion. See [Expanding Wildcard Arguments](../c-language/expanding-wildcard-arguments.md).|
8382

docs/c-runtime-library/potential-errors-passing-crt-objects-across-dll-boundaries.md

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,9 @@ When you pass C Run-time (CRT) objects such as file handles, locales, and enviro
4242
HEAP[]: Invalid Address specified to RtlValidateHeap(#,#)
4343

4444
## Causes
45-
Each copy of the CRT library has a separate and distinct state. As such, CRT objects such as file handles, environment variables, and locales are only valid for the copy of the CRT where these objects are allocated or set. When a DLL and its users use different copies of the CRT library, you cannot pass these CRT objects across the DLL boundary and expect them to be picked up correctly on the other side.
45+
Each copy of the CRT library has a separate and distinct state, kept in thread local storage by your app or DLL. As such, CRT objects such as file handles, environment variables, and locales are only valid for the copy of the CRT in the app or DLL where these objects are allocated or set. When a DLL and its app clients use different copies of the CRT library, you cannot pass these CRT objects across the DLL boundary and expect them to be picked up correctly on the other side. This is particularly true of CRT versions before the Universal CRT in Visual Studio 2015 and later. There was a version-specific CRT library for every version of Visual Studio built with Visual C++ 2013 or earlier. Internal implementation details of the CRT, for example, its data structures and naming conventions, were different in each version. Dynamically linking code compiled for one version of the CRT to a different version of the CRT DLL has never been supported, though occasionally it would work, more by luck than by design.
4646

47-
Also, because each copy of the CRT library has its own heap manager, allocating memory in one CRT library and passing the pointer across a DLL boundary to be freed by a different copy of the CRT library is a potential cause for heap corruption.
48-
49-
If you design your DLL so that it passes CRT objects across the boundary or allocates memory and expects it to be freed outside the DLL, you restrict the DLL users to use the same copy of the CRT library as the DLL. The DLL and its users use the same copy of the CRT library only if both are linked with the same version of the CRT DLL. This could be a problem if you mix applications built with Visual C++ 5.0 with DLLs that are built by Visual C++ 4.1 or earlier. Because the DLL version of the CRT library used by Visual C++ 4.1 is msvcrt40.dll and the one used by Visual 5.0 is msvcrt.dll, you cannot build your application to use the same copy of the CRT library as these DLLs.
50-
51-
However, there is an exception. In US English version and some other localized versions of Windows 2000, such as German, French, and Czech, a forwarder version of the msvcrt40.dll (version 4.20) is shipped. As a result, even though the DLL is linked with msvcrt40.dll and its user is linked with msvcrt.dll, you are still using the same copy of the CRT library because all calls made to msvcrt40.dll are forwarded to msvcrt.dll.
52-
53-
However this forwarder version of msvcrt40.dll is not available in some localized versions of Windows 2000, such as Japanese, Korean, and Chinese. So, if your application targets these operating systems, you need to either obtain an upgraded version of the DLL that doesn't rely on msvcrt40.dll or alter your application to not rely on using the same copy of the CRT libraries. If you have developed the DLL, this means rebuilding it with Visual C++ 4.2 or later. If it is a third- party DLL, you need to contact your vendor for an upgrade.
54-
55-
Please note that this forwarder DLL version of msvcrt40.dll (version 4.20) cannot be redistributed.
47+
Also, because each copy of the CRT library has its own heap manager, allocating memory in one CRT library and passing the pointer across a DLL boundary to be freed by a different copy of the CRT library is a potential cause for heap corruption. If you design your DLL so that it passes CRT objects across the boundary or allocates memory and expects it to be freed outside the DLL, you restrict the app clients of the DLL to use the same copy of the CRT library as the DLL. The DLL and its clients normally use the same copy of the CRT library only if both are linked at load time to the same version of the CRT DLL. Because the DLL version of the Universal CRT library used by Visual Studio 2015 and later on Windows 10 is now a centrally deployed Windows component, ucrtbase.dll, it is the same for apps built with Visual Studio 2015 and later versions. However, even when the CRT code is identical, you can't hand off memory allocated in one heap to a component that uses a different heap.
5648

5749
## Example
5850

@@ -63,11 +55,9 @@ When you pass C Run-time (CRT) objects such as file handles, locales, and enviro
6355

6456
If you rebuild with /MT so that they use separate copies of the CRT, running the resulting test1Main.exe results in an access violation.
6557

66-
### Code
67-
68-
```
58+
```cpp
6959
// test1Dll.cpp
70-
// compile with: /MD /LD
60+
// compile with: cl /EHsc /W4 /MD /LD test1Dll.cpp
7161
#include <stdio.h>
7262
__declspec(dllexport) void writeFile(FILE *stream)
7363
{
@@ -77,11 +67,9 @@ __declspec(dllexport) void writeFile(FILE *stream)
7767
}
7868
```
7969
80-
### Code
81-
82-
```
70+
```cpp
8371
// test1Main.cpp
84-
// compile with: /MD test1dll.lib
72+
// compile with: cl /EHsc /W4 /MD test1Main.cpp test1Dll.lib
8573
#include <stdio.h>
8674
#include <process.h>
8775
void writeFile(FILE *stream);
@@ -95,9 +83,7 @@ int main(void)
9583
}
9684
```
9785

98-
### Output
99-
100-
```
86+
```Output
10187
this is a string
10288
```
10389

@@ -106,11 +92,9 @@ this is a string
10692
### Description
10793
This example passes environment variables across a DLL boundary.
10894

109-
### Code
110-
111-
```
95+
```cpp
11296
// test2Dll.cpp
113-
// compile with: /MT /LD
97+
// compile with: cl /EHsc /W4 /MT /LD test2Dll.cpp
11498
#include <stdio.h>
11599
#include <stdlib.h>
116100

@@ -128,13 +112,11 @@ __declspec(dllexport) void readEnv()
128112
printf( "MYLIB has not been set.\n");
129113
free( libvar );
130114
}
131-
```
115+
```
132116
133-
### Code
134-
135-
```
117+
```cpp
136118
// test2Main.cpp
137-
// compile with: /MT /link test2dll.lib
119+
// compile with: cl /EHsc /W4 /MT test2Main.cpp test2dll.lib
138120
#include <stdlib.h>
139121
#include <stdio.h>
140122
@@ -147,9 +129,7 @@ int main( void )
147129
}
148130
```
149131

150-
### Output
151-
152-
```
132+
```Output
153133
MYLIB has not been set.
154134
```
155135

docs/c-runtime-library/reference/fmax-fmaxf-fmaxl.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ long double fmaxl(
119119

120120
|Function|C header|C++ header|
121121
|--------------|--------------|------------------|
122-
|`fmax`, `fmaxf`, `fmaxl`|\<math.h>|\<cmath>|
122+
|`fmax`, `fmaxf`, `fmaxl`|\<math.h>|\<cmath> or \<math.h>|
123123

124124
For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
125125

126126
## See Also
127127
[Alphabetical Function Reference](../../c-runtime-library/reference/crt-alphabetical-function-reference.md)
128-
[fmin, fminf, fminl](http://msdn.microsoft.com/Library/719840c7-8edd-4a83-bad9-5cc39b73d5a7)
128+
[fmin, fminf, fminl](fmin-fminf-fminl.md)

docs/c-runtime-library/reference/fmin-fminf-fminl2.md renamed to docs/c-runtime-library/reference/fmin-fminf-fminl.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "fmin, fminf, fminl2 | Microsoft Docs"
2+
title: "fmin, fminf, fminl | Microsoft Docs"
33
ms.custom: ""
44
ms.date: "11/04/2016"
55
ms.reviewer: ""
@@ -87,7 +87,6 @@ long double fminl(
8787
long double x,
8888
long double y
8989
);
90-
9190
```
9291

9392
#### Parameters
@@ -104,7 +103,7 @@ long double fminl(
104103
|-----------|------------|
105104
|`x` is NaN|`y`|
106105
|`y` is NaN|`x`|
107-
|`x` and `y` are NaN|nan|
106+
|`x` and `y` are NaN|NaN|
108107

109108
The function does not cause [_matherr](../../c-runtime-library/reference/matherr.md) to be invoked, cause any floating-point exceptions, or change the value of `errno`.
110109

@@ -115,9 +114,10 @@ long double fminl(
115114

116115
|Routine|Required header|
117116
|-------------|---------------------|
118-
|`fmin`, `fminf`, `fminl`|C: \<math.h><br /><br /> C++: \<math.h> or \<cmath>|
117+
|`fmin`, `fminf`, `fminl`|C: \<math.h><br />C++: \<math.h> or \<cmath>|
119118

120119
For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
121120

122121
## See Also
123-
[Alphabetical Function Reference](../../c-runtime-library/reference/crt-alphabetical-function-reference.md)
122+
[Alphabetical Function Reference](../../c-runtime-library/reference/crt-alphabetical-function-reference.md)
123+
[fmax, fmaxf, fmaxl](fmax-fmaxf-fmaxl.md)

docs/porting/use-native-multi-targeting.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ Once you have installed Visual Studio side-by-side with your older version, open
5656

5757
Visual Studio is persistent about upgrading your project. To avoid seeing the upgrade dialog every time you load the project, you can define the following property in your projects, or in the .props or .targets files they import:
5858

59-
```
60-
<VCProjectUpgraderObjectName>NoUpgrade</VCProjectUpgraderObjectName>
61-
```
59+
`<VCProjectUpgraderObjectName>NoUpgrade</VCProjectUpgraderObjectName>`
6260

6361
You must remove this property when you want to upgrade your projects.
6462

@@ -84,13 +82,15 @@ You may have an old Visual C++ project that you can't or don't want to upgrade,
8482

8583
Here are some of the Visual Studio downloads you might need:
8684

87-
- [Microsoft Visual Studio 2008 Service Pack 1](https://www.microsoft.com/en-us/download/details.aspx?id=10986)
88-
- [Microsoft Visual Studio 2010 Service Pack 1](https://www.microsoft.com/en-gb/download/details.aspx?id=23691)
89-
- [Microsoft Visual Studio Express 2012 for Windows Desktop
90-
](https://www.microsoft.com/en-us/download/details.aspx?id=34673)
91-
- [Microsoft Visual Studio Express 2013 for Windows Desktop with Update 5
92-
](https://www.microsoft.com/en-us/download/details.aspx?id=48131)
9385
- [Microsoft Visual Studio Community 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48146)
86+
- [Microsoft Visual Studio Express 2013 for Windows Desktop with Update 5](https://www.microsoft.com/en-us/download/details.aspx?id=48131)
87+
- [Microsoft Visual Studio Express 2012 for Windows Desktop](https://www.microsoft.com/en-us/download/details.aspx?id=34673)
88+
- [Visual Studio 2012 Update 5](https://www.microsoft.com/en-us/download/details.aspx?id=34673)
89+
- [Microsoft Visual C++ 2010 Express (Web Installer)](https://download.microsoft.com/download/1/D/9/1D9A6C0E-FC89-43EE-9658-B9F0E3A76983/vc_web.exe)
90+
- [Microsoft Visual Studio 2010 Service Pack 1](https://www.microsoft.com/en-us/download/details.aspx?id=23691)
91+
- [Microsoft Visual C++ 2008 Express with SP1 (Web Installer)](https://go.microsoft.com/?linkid=7729279)
92+
93+
When these products are installed, the
9494

9595
## See Also
9696
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)

docs/windows/walkthrough-creating-a-standard-cpp-program-cpp.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ You can use Visual C++ in the Visual Studio integrated development environment (
8686
If you used the sample program, a command window is displayed and shows whether certain integers are found in the set.
8787

8888
## Next Steps
89-
**Previous:** [Creating Command-Line Applications (C++)](http://msdn.microsoft.com/en-us/2505d9ed-aca4-426a-9071-078a2d707254). **Next:**[Walkthrough: Compiling a Native C++ Program on the Command Line](../build/walkthrough-compiling-a-native-cpp-program-on-the-command-line.md).
89+
**Previous:** [Console Applications in Visual C++](../windows/console-applications-in-visual-cpp.md). **Next:**[Walkthrough: Compiling a Native C++ Program on the Command Line](../build/walkthrough-compiling-a-native-cpp-program-on-the-command-line.md).
9090

9191
## See Also
92-
[Visual C++ Guided Tour](http://msdn.microsoft.com/en-us/499cb66f-7df1-45d6-8b6b-33d94fd1f17c)
9392
[C++ Language Reference](../cpp/cpp-language-reference.md)
9493
[C++ Standard Library](../standard-library/cpp-standard-library-reference.md)

0 commit comments

Comments
 (0)