Skip to content

Commit e2050b9

Browse files
committed
check for _STATIC_INLINE_UCRT_FUNCTIONS to determine if UCRT functions can be naively exported through modules
1 parent eb024e0 commit e2050b9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

stl/inc/ctime

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ _EXPORT_STD using _CSTD strftime;
2929
_EXPORT_STD using _CSTD timespec;
3030
#endif // _HAS_CXX17
3131

32-
#ifdef _BUILD_STD_MODULE // TRANSITION, OS-33790456; `template <int = 0>` avoids ambiguity
32+
// `_STATIC_INLINE_UCRT_FUNCTIONS` is exposed by the UCRT starting on Windows SDK `10.0.26100.6901`.
33+
// When set to `1`, several UCRT functions are declared as `static inline` (for historical compatibility),
34+
// preventing them from being naively exported through modules.
35+
// In that case, we use templates to shadow their name, allowing us forcibly to export them.
36+
#if defined(_STATIC_INLINE_UCRT_FUNCTIONS) && _STATIC_INLINE_UCRT_FUNCTIONS == 1
3337
_STL_DISABLE_DEPRECATED_WARNING
3438

3539
_EXPORT_STD template <int = 0>
@@ -75,7 +79,7 @@ _Check_return_ inline int __CRTDECL timespec_get(_Out_ timespec* const _Ts, _In_
7579
_STL_RESTORE_DEPRECATED_WARNING
7680
#else // ^^^ workaround / no workaround vvv
7781

78-
// _EXPORT_STD has no effect while the workaround is present.
82+
// _EXPORT_STD has no effect when `_BUILD_STD_MODULE` is not defined.
7983
_EXPORT_STD using _CSTD ctime;
8084
_EXPORT_STD using _CSTD difftime;
8185
_EXPORT_STD using _CSTD gmtime;

0 commit comments

Comments
 (0)