我正在使用C ++ / WinRT为uwp创建一个winrt组件。我定义了一个像blew这样的运行时类,
{
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "../out-tsc/app",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom",
"esnext.array"
]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
],
"angularCompilerOptions": {
"entryModule": "app/app.server.module#AppServerModule"
}
}
然后cppwinrt编译器生成如下代码,
namespace TagLibUWP
{
[bindable]
[default_interface]
runtimeclass Picture
{
Picture();
UInt8[] Data{ get; set; };
}
}
已编译了winrt组件,但是当另一个UWP应用程序(使用C ++ / WinRT编写)引用该组件时,该应用程序将无法编译。
错误就像是自爆,
struct Picture : PictureT<Picture>
{
Picture() = default;
com_array<uint8_t> Data();
void Data(array_view<uint8_t const> value);
};
让我感到困惑的是,可以编译uwp应用程序(用C#编写)。
简而言之,我只想替换C ++ / CX中的Array。我找到了this,这不是我想要的。我想知道的是如何在MIDL 3.0中定义字节数组的属性。我已经尝试过以上方法,但似乎无法完成以上操作。
那么有人可以帮助我解决这个问题吗?