3 ms·
I was interested in why also since there was already JNI. This is what i found >>> The FFM API allows Java programs to interoperate safely and more easily with
by Racing0461 3y ago
I was interested in why also since there was already JNI. This is what i found
>>> The FFM API allows Java programs to interoperate safely and more easily with code and data outside the Java runtime. Unlike JNI, which often involves brittle and error-prone boilerplate code, the FFM API aims to provide a more straightforward and safer method for calling native libraries and manipulating native data.
- TeMPOraL 3y agoThat sounds like a zero-information marketing blurb, though. The interesting bits would be not the claims, but how they're realized - i.e. how FFM is implemented and what's the difference between how it works and how the implementation is different from JNI.
- kaba0 3y agoThey have low-overhead temporal-, spatial-, and thread- safety guarantees. Spatial in that every “C pointer”=MemorySegment is associated with bounds, which is checked at runtime. Temporal, in that such a MemorySegment has a scope (usually created in a try-with resource block, being closed right afterwards, or alternatively at a random later point, up to the GC), outside of which it can’t be called (also, freeing actions can be associated with these). Thread safety, in that a scope also determines the availability of a given segment to other threads (must be explicitly specified to be accessible mutably from multiple threads).