Skip to content

Instantly share code, notes, and snippets.

View mcimadamore's full-sized avatar

Maurizio Cimadamore mcimadamore

View GitHub Profile
@mcimadamore
mcimadamore / CustomMappedSegment.java
Last active March 31, 2022 18:31
An example of how to implement a mapped memory segment on top of the Panama ABI support
import jdk.incubator.foreign.Addressable;
import jdk.incubator.foreign.CLinker;
import jdk.incubator.foreign.FunctionDescriptor;
import jdk.incubator.foreign.MemoryAddress;
import jdk.incubator.foreign.MemoryLayout;
import jdk.incubator.foreign.MemorySegment;
import jdk.incubator.foreign.ResourceScope;
import jdk.incubator.foreign.SegmentAllocator;
import jdk.incubator.foreign.SequenceLayout;
import jdk.incubator.foreign.ValueLayout;