Skip to content

Remove WINRT_EXPORT in Component.g.cpp#1597

Open
YexuanXiao wants to merge 3 commits into
microsoft:masterfrom
YexuanXiao:cleanup-component-export
Open

Remove WINRT_EXPORT in Component.g.cpp#1597
YexuanXiao wants to merge 3 commits into
microsoft:masterfrom
YexuanXiao:cleanup-component-export

Conversation

@YexuanXiao

Copy link
Copy Markdown
Contributor

The WINRT_EXPORT namespace block here only contains definitions of the component's member functions, so it is meaningless.

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

Updates the C++/WinRT code generator to omit WINRT_EXPORT on the namespace winrt::<type_namespace> block in generated component .g.cpp files, since that block contains only member-function definitions and the export annotation is not meaningful there.

Changes:

  • Switch component .g.cpp generation to open namespace winrt::<ns> without WINRT_EXPORT.
  • Add a dedicated writer helper to emit a non-exported winrt::<ns> namespace wrapper.

Reviewed changes

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

File Description
cppwinrt/component_writers.h Uses the new non-export namespace wrapper for generated component .g.cpp member definitions.
cppwinrt/code_writers.h Adds wrap_type_namespace_without_export helper to emit namespace winrt::<ns> without WINRT_EXPORT.

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.

3 participants