简体   繁体   English

Java 和 C++ 共享内存

[英]Java and C++ Shared Memory

I have a C++ piece of code that creates shared memory.我有一段创建共享内存的 C++ 代码。 Is it possible to write Java Code which can read the memory created by the C++ code unless using JNI.除非使用 JNI,否则是否可以编写可以读取由 C++ 代码创建的内存的 Java 代码。 By the way I am using Windows OS.顺便说一下,我使用的是 Windows 操作系统。

See MappedByteBuffer .请参阅MappedByteBuffer It's the standard Java class to read & write shared memory.它是读取和写入共享内存的标准 Java 类。 I use it a lot.我经常使用它。 Yes, you can use this to communicate with any program written in any language which uses shared memory, and it's all very standard Java, no JNI.是的,您可以使用它与使用共享内存的任何语言编写的任何程序进行通信,而且都是非常标准的 Java,没有 JNI。

是的,您可以使用代码项目: 代码项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM