

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
12 messages in net.java.dev.jna.usersRe: [jna-users] Problem returning Str...| From | Sent On | Attachments |
|---|---|---|
| Duncan McGregor | Feb 9, 2009 2:13 pm | |
| Timothy Wall | Feb 9, 2009 2:24 pm | |
| Timothy Wall | Feb 9, 2009 2:31 pm | |
| Duncan McGregor | Feb 9, 2009 4:22 pm | |
| Timothy Wall | Feb 9, 2009 4:57 pm | |
| Duncan McGregor | Feb 9, 2009 5:39 pm | |
| Timothy Wall | Feb 9, 2009 5:48 pm | |
| Timothy Wall | Feb 9, 2009 6:00 pm | |
| Timothy Wall | Feb 9, 2009 6:07 pm | |
| Duncan McGregor | Feb 9, 2009 6:10 pm | |
| Duncan McGregor | Feb 10, 2009 2:53 am | |
| Duncan McGregor | Feb 10, 2009 7:42 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] Problem returning Structure.ByValue on Mac, JNA 3.0.6+ | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | Feb 9, 2009 2:24:19 pm | |
| List: | net.java.dev.jna.users | |
3.0.9: r740 3.0.8: r736 3.0.7: r729 3.0.6: r722 3.0.5: r642
you can check the diffs on native/dispatch.c and native/callback.c from there.
On Feb 9, 2009, at 5:14 PM, Duncan McGregor wrote:
Hello JNA
Rococoa, our little free Java / Cocoa bridge project has an issue with JNA versions after 3.0.5 that I'm finally getting round to trying to diagnose. This is going to be a bit random I'm afraid, but I'm banging my head against a wall, as this used to work.
Given
public class NSSize extends Structure implements Structure.ByValue { public float width; public float height;
public NSSize() {}
public NSSize(int width, int height) { this.width = width; this.height = height; } }
I have a test case
public class StructsInObjectsTest extends RococoaTestCase {
public interface MyLibrary extends Library { NSSize objc_msgSend(ID receiver, Selector selector, Object... args); }
public void test() { NSSize aSize = new NSSize(1, 3); ID idOfNSValueClass = Foundation.getClass("NSValue"); Foundation.nsLog("%@", idOfNSValueClass);
ID idOfValueInstance = Foundation.sendReturnsID(idOfNSValueClass, "valueWithSize:", aSize); Foundation.nsLog("%@", idOfValueInstance);
MyLibrary messageSendLibrary = (MyLibrary) Native.loadLibrary("Foundation", MsgSendLibrary.class); NSSize size = messageSendLibrary.objc_msgSend(idOfValueInstance, Foundation.selector("sizeValue"));
assertEquals(1.0, size.width, 0.0001); assertEquals(3.0, size.height, 0.0001); } }
It isn't usually like this - but that's the lowest level code that fails.
If you trust that the code up to messageSendLibrary.objc_msgSend(... does what it appears to, creating an NSValue with an NSSize
2009-02-09 22:01:25.258 java[28068:1003] NSValue 2009-02-09 22:01:25.260 java[28068:1003] NSSize: {1, 3}
then the objc_msgSend succeeds with JNA 3.0.5, but fails with all versions after that.
Invalid memory access of location 00000020 eip=95afb688
The deepest Java is Function invokeStructure(int callingConvention, Object[] args, Structure result).
Did anything significant change in the underlying native code between 3.0.5 and 3.0.6? Can you offer any help diagnosing, or building a debug native library?
Thanks in anticipation
Duncan McGregor







