I am facing a MSVC COM interface creation issue: The COM API requires __FIReference_1_UINT32 type arguments which is also the IReference type.
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Value(
/* [out][retval] */ __RPC__deref_out_opt __FIReference_1_UINT32 **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Value(
/* [in] */ __RPC__in_opt __FIReference_1_UINT32 *value) = 0;
And I tried RoActivateInstance function. But it gets non register class error.
ComPtr<__FIReference_1_UINT32_t> fValue;
const wchar_t str[] = __FIReference_1_UINT32_t::z_get_rc_name_impl();//L"Windows.Foundation.IReference1<UInt32>";
hr = RoActivateInstance(HString::MakeReference(str).Get(), &fValue);
Really appreciated if someone could give me some hints.
I just had a similar problem and did a bit of digging. I found that, as commented, the C++/CX language extension implements IBox to support reference types, its implementation appears to be entirely within the winmd lib file that is linked in so it not available to ISO c++. I was able to get my case to work by creating a basic version a com object impl of IReference by reusing some helper classes I already had. It returns E_NOTIMPL for the IInspectable methods and uses 'stack' based com object semantics, which should be ok for simple setters where i wouldnt expect com references to the holder object to be kept.
then use as...