Emscripten:如何为C ++数组类型定义webidl

问题描述 投票:0回答:1

[嗨,我正在尝试将QR库查询转换为WASM。为此,我编写了一个C ++包装器,以便可以使用webIDL使转换更直接。但是我在webIDL中定义数组类型时遇到麻烦。下一个代码段正确的webIDL是什么

        struct Point {
            int x;
            int y;
        };

        struct Code {
            /* The four corners of the QR-code, from top left, clockwise */
            Point corners[4];

            /* The number of cells across in the QR-code. The cell bitmap
            * is a bitmask giving the actual values of cells. If the cell
            * at (x, y) is black, then the following bit is set:
            *
            *     cell_bitmap[i >> 3] & (1 << (i & 7))
            *
            * where i = (y * size) + x.
            */
            int         size;
            uint8_t     cell_bitmap[QUIRC_MAX_BITMAP];
        };

c++ emscripten webidl
1个回答
0
投票

下面的idl文件有效

interface Point {
    attribute long x;
    attribute long y;
};

interface Code {
    [Value] attribute Point[] corners;
    attribute long size;
    [BoundsChecked] attribute byte[] cell_bitmap;
};
© www.soinside.com 2019 - 2024. All rights reserved.