Sorry, this maybe a basic question. What are the difference between JNA direct mapping and interface mapping?
Is my interpretation correct:
Direct mapping: use the library object directly (like static main in Java)
Interface mapping: create an instance of the library object.
Thanks in advance!
Direct mapping directly binds your Java methods (declared with the native
modifier) to native code which attempts to use the call stack as-is. Direct mapping is most effective if you restrict your function arguments and return values to primitive types (the Pointer
type may be considered primitive).
The interface mapping uses a Proxy
and dynamically translates Java function signatures into a generic native entry point with a list of arguments which must subsequently be translated into native primitives. It's more flexible w/r/t translating Java types to and from native, but can be much slower due to the runtime translation of arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With