10 messages in net.java.dev.jna.usersRe: [jna-users] Problem with Structur...
FromSent OnAttachments
Rob CopeSep 13, 2007 9:22 pm 
Rob CopeSep 13, 2007 9:36 pm 
Rob CopeSep 13, 2007 9:37 pm 
Rob CopeSep 13, 2007 9:59 pm 
Timothy WallSep 14, 2007 4:50 am 
Timothy WallSep 14, 2007 4:58 am 
Rob CopeSep 14, 2007 8:17 am 
Rob CopeSep 14, 2007 9:17 am 
Timothy WallSep 14, 2007 9:27 am 
Rob CopeSep 14, 2007 7:19 pm 
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] Problem with Structure[] field in StructureActions...
From:Timothy Wall (twal@dev.java.net)
Date:Sep 14, 2007 4:50:56 am
List:net.java.dev.jna.users

On Sep 14, 2007, at 12:37 AM, Rob Cope wrote:

By the way, I also tried this:

public static class SecKeychainAttributeList extends Structure { public int count; public Structure[] attr; }

and then setting up the call like this:

SecKeychainAttribute attr = new SecKeychainAttribute(); ... SecKeychainAttributeList attrList = new SecKeychainAttributeList(); attrList.attr = attr.toArray(1);

That avoided the NullPointerException, but gave me this instead:

java.lang.IllegalArgumentException: Native type undefined for class com.sun.jna.Structure

In this case, the error message is misleading. Arrays of Structure[] are interpreted as inline arrays, but the problem here is that the base class Structure has no size, and so the space to allocate for the array is unknown.