4 messages in net.java.dev.jna.usersRe: [jna-users] struct containing poi...
FromSent OnAttachments
seb bratieresJul 17, 2007 7:28 am 
Timothy WallJul 17, 2007 9:19 am 
j impalaJul 17, 2007 10:24 am 
Timothy WallJul 17, 2007 11:26 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] struct containing pointer to struct arrayActions...
From:Timothy Wall (twal@dev.java.net)
Date:Jul 17, 2007 11:26:26 am
List:net.java.dev.jna.users

On Jul 17, 2007, at 1:24 PM, j impala wrote:

Hi Timothy, thanks for looking into this, and most importantly thanks for that amazing work you're putting into JNA. I think it is high quality.

Your remark was helpful as I had not understood that JNA actually makes use of the contiguitiy of the Java array. Your suggestion, however, won't work. In fact, contrary to what you write, I am not even accessing the second element of the array in the C test code. I would like to, of course, but hadn't yet done so.

So there must be something else going on. An idea ?

Given that your code fails when it tries to print the "name" field, that would suggest that the name field is not properly initialized. You declare it as a Pointer, but you don't show how it is initialized.

Windows will crash if you do a %s with a null pointer.

You should define it as the appropriate String type (String or WString, depending on whether TCHAR is char or wchar_T), and just assign it a normal Java string.