How to attach to a shared memory from Java 17 that was created from C++ using ftok() and shmget()

5 days ago 4
ARTICLE AD BOX

I have a Linux C++ application that creates a shared memory using ftok() to create a key based on a file and then shmget() to create a shared memory for the key.

How do I attach to this shared memory from Java using the Java 17 Foreign Function and Memory API ?

Do I have to lookup and invoke ftok() and shmget() C++ functions from Java or is there a shorter way, e.g. using MemorySegment.mapFile() or ... ?

Read Entire Article