This file is a tiny “Java calls C” demo using the Foreign Function & Memory (FFM) API:
It finds the native functionstrlen from the system C library.
strlen
It builds a Java handle for it (so Java knows how to call it and what types it expects).
It allocates a native string () in a safe, temporary memory scope. "Hello FFM"
"Hello FFM"
It calls on that native string and prints the length, then automatically cleans up the native memory when done. strlen
Last updated 21 days ago