Skip to content

Commit 4c5b50c

Browse files
author
Colin Robertson
authored
Merge pull request #2517 from MicrosoftDocs/master637375206735550574
Repo sync for protected CLA branch
2 parents 5f5ea74 + 1c95768 commit 4c5b50c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/c-runtime-library/global-state.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
title: "Global state in the CRT"
33
description: "Describes how shared global state is handled in the Microsoft Universal C Runtime."
44
ms.topic: "conceptual"
5-
ms.date: "04/02/2020"
5+
ms.date: "10/02/2020"
66
helpviewer_keywords: ["CRT global state"]
77
---
88

99
# Global state in the CRT
1010

1111
Some functions in the Universal C Runtime (UCRT) use global state. For example, `setlocale()` sets the locale for the entire program, which affects the digit separators, text code page, and so on.
1212

13-
The UCRT's global state is not shared between applications and the OS. For example, if your application calls `setlocale()`, it won't affect the locale for any OS components that uses the C run-time, or vice-versa.
13+
The UCRT's global state isn't shared between applications and the OS. For example, if your application calls `setlocale()`, it won't affect the locale for any OS components that uses the C run-time, or the other way around.
1414

1515
## OS-specific versions of CRT functions
1616

@@ -25,8 +25,8 @@ The OS-specific versions of these functions are in `ucrt.osmode.lib`. For exampl
2525

2626
There are two ways to isolate your component's CRT state from an app's CRT state:
2727

28-
- Statically link your component by using compiler options /MT (release) or MTd (debug). For details, see [/MD, /MT, /LD](../build/reference/md-mt-ld-use-run-time-library.md). Note that static linking can greatly increase binary size.
29-
- Starting with Windows 10 20H2, get CRT state isolation by dynamically linking to the CRT but call the OS-mode exports (the functions that begin with _o_). To call the OS-mode exports, statically link as before, but ignore the static UCRT by using linker option `/NODEFAULTLIB:libucrt.lib` (release) or `/NODEFAULTLIB:libucrtd.lib` (debug) See [/NODEFAULTLIB (Ignore Libraries)](../build/reference/nodefaultlib-ignore-libraries.md) for details. And add `ucrt.osmode.lib` to the linker input.
28+
- Statically link your component by using compiler options `/MT` (release) or `/MTd` (debug). For details, see [/MD, /MT, /LD](../build/reference/md-mt-ld-use-run-time-library.md). Static linking can greatly increase binary size.
29+
- Starting with Windows 10 version 2004, dynamically link to the CRT but call the OS-mode exports (the functions that begin with _o_). To call the OS-mode exports, statically link as before, but ignore the static UCRT by using linker option `/NODEFAULTLIB:libucrt.lib` (release) or `/NODEFAULTLIB:libucrtd.lib` (debug). And add `ucrt.osmode.lib` to the linker input. See [/NODEFAULTLIB (Ignore Libraries)](../build/reference/nodefaultlib-ignore-libraries.md) for details.
3030

3131
> [!Note]
3232
> In source code, write `setlocale()`, not `_o_setlocale()`. When you link against `ucrt.osmode.lib`, the linker will automatically substitute the OS-specific version of the function. That is, `setlocale()` will be substituted with `_o_setlocale()`.
@@ -53,7 +53,7 @@ Global state affected by the separation of app and OS state includes:
5353
- The buffer used by [_putch, _putwch](reference/putch-putwch.md)
5454
- [_set_invalid_parameter_handler, _set_thread_local_invalid_parameter_handler](reference/set-invalid-parameter-handler-set-thread-local-invalid-parameter-handler.md)
5555
- [_set_new_handler](reference/set-new-handler.md) and [_set_new_mode](reference/set-new-mode.md)
56-
- [fmode] (text-and-binary-mode-file-i-o.md)
56+
- [fmode](text-and-binary-mode-file-i-o.md)
5757
- [Time zone information](time-management.md)
5858

5959
## See also

0 commit comments

Comments
 (0)