-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.IllegalStateException: Pointer native already mapped to Proxy interface to native function #326
Comments
You’ve got a case where a pointer value is mapped to a Java callback, then that same pointer shows up with an attempt to map it to a different callback type. On May 12, 2014, at 9:31 PM, Trejkaz (pen name) [email protected] wrote:
|
I wonder how that can happen. The reverse is definitely true, I'm using that PlaceholderCallback to avoid defining (i.e. looking up and manually converting over) all the other callbacks. But any given callback pointer seems like it could only be used with one interface (because the only interface is PlaceholderCallback.) |
I believe the issue is that JNA associates one pointer with one callback object; you can’t have the same callback object mapped to multiple callback pointers. On Jun 19, 2014, at 9:15 PM, Trejkaz (pen name) [email protected] wrote:
|
When you use a callback object, JNA creates a native trampoline that effectively routes execution from a native function pointer to your callback object. Once it has done so, it caches the result (so that we don’t create multiple trampolines). The gap here is that you want a new trampoline (native function pointer) for each unique interface on the callback object, which isn’t currently supported (it could be, although there might need be some internal plumbing to make sure the current callback signature is always available). On Jun 20, 2014, at 8:37 AM, Timothy Wall [email protected] wrote:
|
I`ve a similar problem, but I use definitly different callback classes for each callback. public class ssl_method_st extends Structure {
} Caused by: java.lang.IllegalStateException: Pointer native@0x4a64bc0 already mapped to Proxy interface to native function@0x4a64bc0 (com.sun.jna.openssl.ssl_method_st$ssl_accept_callback) |
I get a similar error, but with a clear wrong pointer http://stackoverflow.com/questions/40157199/jna-pointer-already-mapped-to-proxy-interface |
You could conceivably work around this by avoiding the "magic" value if it's found. Override
|
We use JNA in my company and this is an outstanding issue for us (JNA associates one pointer with one callback object; you can’t have the same callback object mapped to multiple callback pointers). |
Do you? JNA is driven by its users - if noone cares enough to do something, it won't be fixed. |
@matthiasblaesing |
Fix was merged to master. @fpapai implemented a fix, which just got merged. |
I get an exception when I attempt to upgrade to JNA 4.1:
I have narrowed the issue down to a few classes and removed the bits which are not necessary to reproduce the issue:
There are a lot of fields and methods in here where deleting that one method makes the exception no longer happen, but I can't figure out a pattern...
The text was updated successfully, but these errors were encountered: