Add tearoff support to C++/WinRT#348
Merged
Merged
Conversation
Scottj1s
reviewed
Apr 24, 2019
| closable = nullptr; | ||
| REQUIRE(!InteropType::Destroyed); | ||
|
|
||
| // Releasing the tearoof finally destroys the object. |
Scottj1s
reviewed
Apr 24, 2019
| // Creates an implementation of IStringable as a tearoff. | ||
| HRESULT make_stringable(winrt::IInspectable const& object, winrt::hstring const& value, void** result) noexcept | ||
| { | ||
| struct stringable final : abi::IStringable |
Member
There was a problem hiding this comment.
could factor a base_tearoff for m_object mgmt, but if these are the only intended test cases, don't bother
Contributor
Author
There was a problem hiding this comment.
Yes, just examples really.
BenJKuhn
approved these changes
Apr 24, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an advanced feature that most developers won't ever need to deal with. Occasionally there is a need to implement an interface as a COM tearoff and this update adds support for that in C++/WinRT. This also allows C++/WinRT implementations to integrate support for the fast abi forwarding implementation that Scott's been working on. An implementation can simply define the
query_interface_tearofffunction and provide a suitable implementation. Something like this: