Bug: Unexported `extern "C"` block in `base.h` makes `WINRT_IMPL_*` declarations invisible to downstream modules
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 48/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- cpp
- 領域
- build-system
研究方向
Start with the first extern "C" block in base.h and the references in Windows.Foundation.h from wait_for_completed and when_any; the issue identifies winrt.Windows.Foundation.ixx as a place where Clang reports the visibility error. Check how winrt_base exports declarations used by downstream modules, then build the module with Clang to confirm the reported failure is resolved.
由索引模型根據 Issue 內容生成。
描述
Version
3.0.260818.1
Summary
In module builds, base.h is included in the module purview of winrt_base, and winrt.Windows.Foundation gets its base.h declarations via export import winrt_base;.
The first extern "C" block in base.h (declaring WINRT_IMPL_* functions) is not marked export. When Windows.Foundation.h calls WINRT_IMPL_CreateEventW, WINRT_IMPL_SetEvent, and WINRT_IMPL_WaitForSingleObject (in wait_for_completed and when_any), these functions are not visible to name lookup in winrt.Windows.Foundation.
extern "C" in a module purview only specifies C language linkage and global module ownership; it does not export the declarations. MSVC currently masks this bug by exposing unexported extern "C" declarations to importing modules, whereas Clang rejects winrt.Windows.Foundation.ixx with an undeclared/invisible identifier error.
Expected behavior
All declarations in winrt_base that are referenced by downstream namespace modules or generated component files (module.g.cpp) should either be explicitly exported (WINRT_EXPORT / export extern "C") or placed in a shared header included in the global module fragment.
Actual behavior
No response
Additional comments
A few related module-visibility mismatches stem from the same pattern in module builds:
1. Missing <intrin.h> in winrt.Windows.Foundation.ixx: <intrin.h> is only included in the global module fragments of winrt_base.ixx and winrt_numerics.ixx, but strings/base_coroutine_foundation.h (winrt::when_any) directly calls _InterlockedCompareExchangePointer inside winrt.Windows.Foundation.
2. Inconsistent linkage/export specifiers on namespace std specializations:
- strings/base_std_hash.h, strings/base_coroutine_threadpool.h, and strings/base_coroutine_foundation.h use WINRT_IMPL_STD_EXPORT namespace std (extern "C++" without export).
- strings/base_collections_map.h uses WINRT_EXPORT namespace std (export extern "C++").
- strings/base_string.h, strings/base_stringable_format.h, strings/base_stringable_format_1.h, and wrap_std_namespace in cppwinrt/code_writers.h declare std::hash and std::formatter specializations inside the module purview without extern "C++" or export, attaching std specializations to named modules.
- 主要語言
- C++
- 星號
- 1.9k
- 分支
- 288
- 平均合併
- 18 小時 15 分鐘
- 30 天內合併 PR
- 2
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/cppwinrt 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
microsoft/cppwinrt#1646 · 7 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
microsoft/cppwinrt#1554 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 45/100
microsoft/cppwinrt#1647 · 8 則留言 ·
維護者通常 1 天內回覆
-
base_macros.h disables warnings without push/pop, leaking them into consumer translation units可能已有人在做 @DanielJump 於 64 天前認領。 未關閉
難度 1/5 1 小時以內 新手友好度 20/100
維護者通常 1 天內回覆
-
Bug: headers cannot be compiled at high warning levels (MSVC /Wall, clang)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 5/5 一週以上 新手友好度 25/100
microsoft/cppwinrt#1620 · 3 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 microsoft/cppwinrt 的全部 Issue
相似的 Issue
-
Linux npm packaging leaves workspace files that block subsequent CI checkout可能已有人在做 @Spockkk0225 今天認領。 未關閉ci
難度 2/5 1-3 小時 新手友好度 73/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 3 天內回覆
-
Bug
難度 2/5 1-3 小時 新手友好度 68/100
SCIInstitute/SCIRun#2909 ·
維護者通常 2 天內回覆
-
area: packaging blocked dependencies P3: low post-stable value: medium
難度 2/5 1-3 小時 新手友好度 66/100
patrick-hudson/put.gd-desktop#1210 ·
維護者通常 1 天內回覆