Native method binding
Brian S O'Neill
bronee at gmail.com
Wed Dec 18 16:17:39 UTC 2024
On 2024-12-18 07:31 AM, David Lloyd wrote:
>
>
> I definitely understand what you're saying here. However, you
> misunderstand what I'm proposing. I'm not suggesting being able to call
> FFM directly using a plain native method. I'm suggesting being able to
> *bind* a native method to any arbitrary `MethodHandle` that matches its
> exact shape. Getting a matching `MethodHandle` from FFM would be the
> user's job, not the FFM API's job. Technically it wouldn't even be
> limited to FFM.
>
Declaring a method as native is a legacy feature. If JNI was being
designed today, it would almost certainly rely on user-defined
interfaces which are backed by dynamically generated code. That same
approach can be used for dynamically binding MethodHandles to methods.
More information about the panama-dev
mailing list