5 messages in net.java.dev.jna.users[jna-users] Returning String[] from C...
FromSent OnAttachments
Corey PuffaltAug 6, 2008 11:05 am 
Timothy WallAug 6, 2008 12:16 pm 
Corey PuffaltAug 6, 2008 1:06 pm 
Timothy WallAug 6, 2008 2:22 pm 
Corey PuffaltAug 7, 2008 1:23 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:[jna-users] Returning String[] from CallbackActions...
From:Corey Puffalt (cpli@gmail.com)
Date:Aug 6, 2008 11:05:57 am
List:net.java.dev.jna.users

All...

From searching the archives my understanding was that JNA handled automatically mapping C char ** to Java String[] (where the array is assumed to be NULL terminated.) I'm trying to do this with a Callback that returns a String[] but JNA says:

Exception in thread "main" java.lang.IllegalArgumentException: Callback return type class [Ljava.lang.String; requires custom type conversion

Here's the relevant C code definition:

typedef char** (*directories_list_cb)(); extern void register_directory_list_callback(directories_list_cb);

On the Java side I define it as:

interface DirectoryListCallback extends Callback { String[] callback(); }

void register_directory_callback(DirectoryListCallback cb);

Is JNA supposed to handle this type of mapping automatically or did I misunderstand the postings I read?

Thanks, Corey