Bug: Unexported `extern "C"` block in `base.h` makes `WINRT_IMPL_*` declarations invisible to downstream modules
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- cpp
- Domaine
- build-system
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- C++
- Étoiles
- 1.9k
- Forks
- 288
- Merge moyen
- 18 h 15 min
- PR mergées (30 j)
- 2
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/cppwinrt
-
Bug: Missing `<intrin.h>` in `winrt.Windows.Foundation.ixx` in module buildsPeut-être pris @YexuanXiao l’a pris il y a 1 jour. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
microsoft/cppwinrt#1646 · 7 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
microsoft/cppwinrt#1554 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Bug: Standard library headers included inside module purview of `winrt_numerics.ixx`Peut-être pris @YexuanXiao l’a pris il y a 1 jour. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
microsoft/cppwinrt#1647 · 17 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
base_macros.h disables warnings without push/pop, leaking them into consumer translation unitsPeut-être pris @DanielJump l’a pris il y a 65 jours. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 20/100
Les mainteneurs répondent en général sous 1 jour
-
Bug: headers cannot be compiled at high warning levels (MSVC /Wall, clang)Peut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
microsoft/cppwinrt#1620 · 3 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de microsoft/cppwinrt
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
TokisanGames/Terrain3D#1073 ·
Les mainteneurs répondent en général sous 1 jour
-
[Feature]: Fedora 45 repoOuverteenhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
metasequoiaime/msime#10989 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 63/100
KhronosGroup/SPIRV-LLVM-Translator#4151 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
documentation good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
vek-language/vek-lang#1 · 1 commentaire ·