Flex Alchemy:从 C 函数返回 ByteArray
我正在使用 Flex 的 Alchemy 库从 C 文件生成 SWC。我在 c 层中有一个字节数组 (unsigned char buffer[size]
),我想将其作为 ByteArray
返回到 ActionScript 层。我是否必须迭代数组并在每个元素上显式调用 AS3_Set
或者是否有办法立即返回整个 C 数组?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可以通过使用 AS3_ByteArray_writeBytes 函数。
This can be accomplished by using the AS3_ByteArray_writeBytes function of the Alchemy API.
在 C 中,当从 Flash 调用的函数返回时,返回指向 C 数组的指针,如下所示:
然后,在 Flash 中:
或者使用 这些函数从c数组中读取ints/floats/char(你不能只使用ByteArray.readInt(),c中的数字表示方式不同)
In C, when returning from the function called by Flash, return the pointer to the C-array, like this:
Then, in Flash:
Or use these functions to read the ints/floats/char from the c-array (you can't just use ByteArray.readInt(), the numbers in c are represented differently)