Skip to content

Reduce the content exported by Namespace.0.h#1595

Open
YexuanXiao wants to merge 2 commits into
microsoft:masterfrom
YexuanXiao:reduce-export-upstream
Open

Reduce the content exported by Namespace.0.h#1595
YexuanXiao wants to merge 2 commits into
microsoft:masterfrom
YexuanXiao:reduce-export-upstream

Conversation

@YexuanXiao

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 24, 2026 01:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the code generation for Namespace.0.h to reduce what gets exported from the winrt::impl namespace (primarily relevant for C++20 module builds where WINRT_EXPORT expands to export extern "C++").

Changes:

  • Added a wrap_impl_namespace_without_export helper to emit namespace winrt::impl { ... } without WINRT_EXPORT.
  • Updated write_namespace_0_h generation to use the non-exporting winrt::impl wrapper for categories/names/guids and most ABI-related output.
  • Split struct ABI generation into two passes (write_struct_abi_type and write_struct_abi_specialization) so only the struct ABI type emission remains under the exporting wrapper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cppwinrt/file_writers.h Updates Namespace.0.h emission to selectively avoid WINRT_EXPORT and splits struct ABI output into separate wrapped blocks.
cppwinrt/code_writers.h Adds wrap_impl_namespace_without_export and splits struct ABI writer into type vs abi<> specialization emitters.

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.

2 participants