Skip to content

Export WINRT_IMPL_* in winrt_base.ixx so Windows.Foundation can access them - #1644

Open
Yexuan Xiao (YexuanXiao) wants to merge 2 commits into
microsoft:masterfrom
YexuanXiao:patch-11
Open

Yexuan Xiao (YexuanXiao) wants to merge 2 commits into
microsoft:masterfrom
YexuanXiao:patch-11

Conversation

@YexuanXiao

@YexuanXiao Yexuan Xiao (YexuanXiao) commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1643.

winrt.Windows.Foundation.ixx needs WINRT_IMPL_CreateEventW, but WINRT_IMPL_CreateEventW is declared in winrt_base.ixx without being exported. Because MSVC can erroneously access declarations in the global module that should be invisible, this problem was not discovered during the earlier implementation.

The following fix options are also possible:

  • export the needed functions only
  • make base_extern.h a standalone header and include it in the global module fragment
  • add the winrt::impl namespace to these C functions (extern "C" will ensure their linkage).

Since CMake and MSBuild do not yet support building the std module with Clang and STL (this will probably be done next year), no test was added, but this patch is very simple.

@YexuanXiao

Copy link
Copy Markdown
Contributor Author

Ryan Shepherd (@DefaultRyan) Could you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Unexported extern "C" block in base.h makes WINRT_IMPL_* declarations invisible to downstream modules

1 participant