Java Enable Preview: Foreign Function and Memory Interface
summary
Preview of Java’s Foreign Function & Memory Interface shows concrete steps: allocate arenas and memory segments, create a native linker, do a symbol lookup, build a function descriptor and obtain a downcall MethodHandle, then invoke C (examples compile to .dylib/.so/.dll). JDK 22 / Project Panama ships the API, Jextract generates Java bindings from headers, restricted native access requires an explicit runtime flag, and demos include C structs, pointer reinterpretation and calling a Rust library.
AI-written summary · about
chapters (14)
- 0:00Introduction to FFM API
- 1:32What is Foreign Function Memory API
- 13:54Understanding Arenas
- 16:46Linkers and Down Calls
- 21:19First Demo: Calling C Functions
- 27:00Memory Segments and Allocation
- 30:11Working with Structs
- 33:46Handling Pointers
- 38:04Receiving Pointers from C
- 43:51Callbacks and Up Calls
- 49:31Restricted Methods
- 51:17JExtract Tool Overview
- 56:35Demo with Rust Library
- 1:00:13Q&A and Conclusion
related talks
16mForeign Function and Memory API
55mJava 19 Project Panama 4 Newbies
45mProject Panama - Foreign Function & Memory API
51mNative Interoperability with JDK 25 and the FFM API
49mWhen a Java Programmer Meets C
47mInterconnecting Java and Native Code with the FFM API
29mEasily Leverage Native Functions with Project Panama from Java
55mBare metal Java
