Thanks, that worked great!
Rob
On Sep 14, 2007, at 12:27 PM, Timothy Wall wrote:
On Sep 14, 2007, at 12:17 PM, Rob Cope wrote:
So I apparently I was using the wrong syntax in Java. The native
struct is defined like this:
struct SecKeychainAttributeList
{
UInt32 count;
SecKeychainAttribute *attr;
};
What I need on the native side is an array of pointers to
SecKeychainAttributes. So once the Pointer[] is working, that
should do the trick, right?
When defining Structure fields, you should only use an array in
java if an array is used in the native code. In this case, you
want a Pointer, not an array.
However, since your API is expecting the pointer to be an array of
structs, you can use Structure.toArray() to obtain an array of
structs contiguous in memory, then use Structure.getPointer() on
the first element to initialize the structure field.
Also make sure you keep a reference to the structure array until
your native code is done with it, to avoid GC on the Java side.