C#中的JAVA Bytebuffer等效项 [英] JAVA Bytebuffer equivalent in C#

查看:117
本文介绍了C#中的JAVA Bytebuffer等效项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
有一个问题:一个VC ++编译的dll在JAVA程序中接受ByteBuffer分配的变量作为输入(并在执行过程中设置所有Bytes值).现在,我需要在C#程序中使用相同的dll处理结果,但是任何尝试执行外部调用的尝试都会给我System.accessviolationerror:尝试从受保护的内存位置进行读取/写入.有人可以帮我吗?我既没有该dll的文档也没有源代码,很显然,只有可以正常工作的JAVA调用..
谢谢大家.
Giuseppe

Hiya all,
got a problem: a VC++ compiled dll accepts a ByteBuffer allocated variable as input (and sets all Bytes values during its execution) in a JAVA program. Now I need to use the same dll processing result within a C# program, but any attempt to do the external call gives me a System.accessviolationerror: attempt to read/write from a protected memory location. May anyone give me an help? I got neither documentation nor source code for the dll, obviously, just the JAVA calling which correctly works..
Thank u all.
Giuseppe

推荐答案

您可以使用System.IO.MemoryStream并将所有值放入其中MemoryStream.Write并将其转换为类似于
的数组 byte []输入= MemoryStream.ToArray();
如果您可以发布vc ++方法原型/一些细节,将很容易回答
you can use a System.IO.MemoryStream and put all your values to it MemoryStream.Write and convert it to array like
byte[] input = MemoryStream.ToArray();
if you could post the vc++ method prototype / some details it will be easy to answer


这篇关于C#中的JAVA Bytebuffer等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆