

![]() | 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: |
9 messages in net.java.dev.jna.usersRe: [jna-users] Nested Structure Issue| From | Sent On | Attachments |
|---|---|---|
| Peter Schwarz | Sep 22, 2008 2:26 pm | |
| Peter Schwarz | Sep 22, 2008 4:14 pm | |
| Timothy Wall | Sep 22, 2008 7:24 pm | |
| Peter Schwarz | Sep 22, 2008 7:27 pm | |
| Timothy Wall | Sep 22, 2008 7:37 pm | |
| Peter Schwarz | Sep 22, 2008 7:57 pm | |
| Timothy Wall | Sep 22, 2008 9:05 pm | |
| Peter Schwarz | Sep 23, 2008 3:14 pm | |
| Timothy Wall | Sep 23, 2008 4:54 pm |

![]() | 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] Nested Structure Issue | Actions... |
|---|---|---|
| From: | Peter Schwarz (psch...@gemini.edu) | |
| Date: | Sep 22, 2008 7:27:30 pm | |
| List: | net.java.dev.jna.users | |
The Field is one that I need to be able to set, as well. I get the memory access error if I'm setting the value of tp_name, if it's being read internally (by JNA).
If I do leave it as a Pointer in my stucture, how can I set this value, via the JNA API. It's not entirely clear.
On 9/22/08 4:24 PM, "Timothy Wall" <twal...@dev.java.net> wrote:
Strings are populated by reading from memory until a NUL byte is encountered. That doesn't happen with a Pointer.
If the pointer value doesn't point at a valid String, you don't want to read that field.
On Sep 22, 2008, at 7:14 PM, Peter Schwarz wrote:
Hi all (again),
Oddly enough, looking continuing to plug away at this further, I¹m able to get my tests to pass if I use a Pointer instead of a String. The definition of the struct field is:
const char *tp_name;
Instead of using
public String tp_name;
which gives me the memory access error, I¹m using
public Pointer tp_name;
Is there any particular reason this may be happening? Am I missing something simple?
Cheers,
Peter
On 9/22/08 11:26 AM, "Peter Schwarz" <psch...@gemini.edu> wrote:
Hi,
I¹m currently working on adding mappings for structures (PyObject and PyTypeObject to be specific). The PyObject is pretty simple: a ref count and a pointer to its type. The PyTypeObject is much more complicated: Many arrays of structs, function pointers, etc.
I implemented the type object out as far as I need (the ability to define methods, members, etc), and I very quickly started getting errors. In order to find the culprit, I began by removing all the fields, and then adding them back one by one. I started with the int values, and my tests still passed. Once I added back the first String field, the tests fail in the native library with the following error:
Invalid memory access of location 00000001 rip=105fcee5
I¹m not sure what might be causing this sort of error when defining Structure. Any ideas?
Cheers,
Peter







