Is it possible to access a pointer created in c++ in java? Like if I make a string, and make a pointer for the variable (giving the variable a memory place) in c++ is there some command in java that would let me take that pointer and view it? or would I have to output the string to a file, and then preform java file I/O.
Share
You would have to convert it into something java understands through JNI–JNI will have a method to convert your pointer to a string, but then Java will copy the memory and will create a regular Java string out of it–changing your memory after giving it to java will not change the Java string.
I don’t think even JNI allows communications through direct memory access but I could be wrong, I haven’t looked at it lately.