将无符号数组从托管复制到非托管

发布于 2024-08-25 23:06:03 字数 93 浏览 1 评论 0原文

Marshal.copy 仅允许签名数据类型,但我有一个巨大的 uint16 数组要传递给 IPP 代码。有什么想法吗?

循环不安全似乎是错误的......

Marshal.copy allows for signed data types only, but I have a giant array of uint16 to pass to IPP code. Any ideas ?

unsafe for looping on it seems wrong ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

背叛残局 2024-09-01 23:06:03

您可以使用 kernel32 中良好的旧内存复制 API 并声明参数类型以满足您的需求。

[DllImport("kernel32.dll", EntryPoint="RtlMoveMemory")]
static extern void CopyMemory(IntPtr dest, UInt16[] src, int length);

You can use the good old mem copy API from kernel32 and declare the parameter types to fit your needs.

[DllImport("kernel32.dll", EntryPoint="RtlMoveMemory")]
static extern void CopyMemory(IntPtr dest, UInt16[] src, int length);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文