-
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
#463 breaks objective-c's objc_msgSend
call
#1476
Comments
Here is a discussion about TL;DR Someone needs to come up with a real explanation what is the correct calling convention for |
i haven't know c's variadic argument function has such a spec. anyway i found a thread that refer to |
finally i found the answer, but @fkistner already has referred to it at #1394... conclusion: umm it's better to modify about |
I reread the article and disagree, you don't need to disable float promotion, because the call to So my reading is, that this: ((void (*)(id, SEL, float))objc_msgSend)(obj, @selector(log:), M_PI); Needs to be called through this: public class ObjCCalling {
public static interface ObjCBinding extends Library {
public static final ObjCBinding INSTANCE = Native.load("????", ObjCBinding.class);
public static class id extends PointerType {
public id() {
}
public id(Pointer p) {
super(p);
}
}
public static class SEL extends PointerType {
public SEL() {
}
public SEL(Pointer p) {
super(p);
}
}
public void objc_msgSend(id id, SEL sel, float value);
}
} Then everything in the article matches. This is speculation and I did not test this, as I even only guess how |
i realized below by your pointing out. so far...
we (rococoa) should have generated every obj-c method call without varargs. this problem was our side, not JNA. thank you for your participation and discussions. |
patch #463 breaks objective-c's
objc_msgSend
call.i request JNA to make #463 float promotion pluggable.
i mentioned here but i got no response so i promote that to this issue.
i use JNA in my project to talk to objective-c natives.
objective-c natives need to get float argument value of method as float, but the patch #463 promotes float to double.
and #463 is hardcoded, there is no way to change.
below is how i found this issue.
obj-c side
https://github.com/umjammer/rococoa/blob/0.8.5/rococoa-core/src/main/native/test.m#L121-L125
java side
https://github.com/umjammer/rococoa/blob/0.8.5/rococoa-core/src/test/java/org/rococoa/FoundationStructureReturnTest.java#L127-L136
log
i traced around before the call below using a debugger
then i found
jna/src/com/sun/jna/Function.java
Line 776 in 3705b84
caused this issue.
Version of JNA: 5.12.1
Java Virtual Machine:
Operating system:
The text was updated successfully, but these errors were encountered: