Closed sivadeilra closed 4 months ago
As discussed offline, we can extend the identity
vtable pointer such that IDynamicCast
inherits from IInspectable
so that the instance size remains the same and ideally optimize interlocked cost as appropriate.
This provides a new feature for COM developers using the windows-rs crate. It allows for safe dynamic casting from IUnknown to an implementation object. It is based on Rust's Any trait.
Any type that is marked with #[implement], except for those that contain non-static lifetimes, can be used with dynamic casting.
Example: