We can pull the string on our current 'all-static' approach for jextract further by replacing the `ofAddress` factory in the functional interface classes we generate with a static invoke method.
This would avoid clients having to create an intermediate instance of the FI in order to invoke a function pointer they got back from native code.
MemorySegment ptr = ...
FP.ofAddress(ptr, someArena).apply(42);
->
MemorySegment ptr = ...
FP.invoke(ptr, 42);
It would also make it easier to deal with function pointers which return by-value structs, since the proposed 'invoke' method could just accept an additional SegmentAllocator argument.
This would avoid clients having to create an intermediate instance of the FI in order to invoke a function pointer they got back from native code.
MemorySegment ptr = ...
FP.ofAddress(ptr, someArena).apply(42);
->
MemorySegment ptr = ...
FP.invoke(ptr, 42);
It would also make it easier to deal with function pointers which return by-value structs, since the proposed 'invoke' method could just accept an additional SegmentAllocator argument.