I'm creating a winrt component for uwp with C++/WinRT. And I defined a runtimeclass like blew,
namespace TagLibUWP
{
[bindable]
[default_interface]
runtimeclass Picture
{
Picture();
UInt8[] Data{ get; set; };
}
}
Then the cppwinrt compiler generates the code like this,
struct Picture : PictureT<Picture>
{
Picture() = default;
com_array<uint8_t> Data();
void Data(array_view<uint8_t const> value);
};
The winrt component was compiled, but when another UWP app (written with C++/WinRT) reference to the component, the app failure to compile.
The error is like blew,
Error C2664 'auto winrt::impl::consume_TagLibUWP_IPicture<winrt::TagLibUWP::IPicture>::Data(winrt::array_view<const uint8_t>) const':
cannot convert argument 1 from 'winrt::com_ptr<To>' to 'winrt::array_view<const uint8_t>'
with
[
To=uint8_t []
] BlankApp1 C:\Users\Cool-\source\repos\Test\TagLib\BlankApp1\Generated Files\XamlTypeInfo.g.cpp 88
What makes me confused is that a uwp app (written with C#) can be compiled.
In short, I just want a replacement of Array in C++/CX. I have found this, which is not I want. Waht I want to know is how to define a property of byte array in MIDL 3.0. I have tried like above but it seems that I can't do it like above.
So can somebody help me with this problem?