Loading topic
MemorySegment is and can use try-with-resources. It also assumes Java 22 or later. Here you learn how an Arena decides when native memory is freed, and how to pick the right kind.2 min readMemorySegment is and how an Arena allocates one. It also assumes you know C's basic types. A segment is only bytes. A value layout tells Java how to read a group of those bytes as a number or a pointer.2 min readMemorySegment, Arena, and ValueLayout from the earlier chapters, plus how C structs sit in memory. A ValueLayout describes one primitive or pointer. A memory layout combines value layouts into a larger shape, such as a C struct or array.2 min readMemorySegment is and that you can read a C function signature. Before Java can call a native function, it needs the function's address. A SymbolLookup supplies that address.2 min readFunctionDescriptor tells the Linker the shape of a C function: the layout of each parameter and of the return value. This chapter assumes you know the ValueLayout constants from the earlier chapters and can read a C prototype. The next chapter uses descriptors to create downcall handles.2 min readMethodHandle, the basics of Arena and MemorySegment, and how to read a C signature. It needs JDK 22 or later.2 min readArena. It uses the Java 22 method names. Java 23 and later renamed them, as noted below.3 min readLinker, SymbolLookup and FunctionDescriptor, and that you know what a module is in the Java module system. It explains why the JVM sometimes prints a warning when you run FFM code and how to control it.2 min readArena. If not, read the chapters on downcall handles and arenas first.2 min readLinker, a symbol and a FunctionDescriptor.2 min readLinker, a symbol and a FunctionDescriptor. Here you will handle C functions that take a variable number of arguments.2 min readFunctionDescriptor, MemoryLayout and Arena, and that you have JDK 22 or later.2 min read