4 messages in net.java.dev.jna.usersquestion about Strings and array poin...
FromSent OnAttachments
Simon BASLEMay 31, 2007 11:08 am 
Timothy WallMay 31, 2007 11:29 am 
Simon BASLEJun 8, 2007 7:41 am 
Timothy WallJun 8, 2007 11:39 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:question about Strings and array pointersActions...
From:Simon BASLE (sba@free.fr)
Date:May 31, 2007 11:08:58 am
List:net.java.dev.jna.users

Hello,

I'm currently doing a project involving accessing a (linux-based) C library in Java. I've tried and messed with JNI shortly then discovered JNA... What a relief, what a great piece of software... so first of all, Thank You! ;) But I'd like to have more information about Strings and array pointers. Let me explain :

- Strings : I have a function that is supposed to return a string, with the following signature : int upkstr(char *str)... Trying to map it to the java int upkstr(String str) doesn't work (String are immutable objects and a call like upkstr(oneExistingString) leaves oneExistingString unchanged :( How can I get a String result when it is not from the return parameter of the C function?

-Arrays pointers : I'd like to know a little more on how to map pointers to arrays in C (eg in a function that has following signature : pkint(int *anArrayOfInts, int arraylength) ? Maybe there's more details in the examples, haven't looked through them yet... If so could you point me where to search ;)

Thank you in advance! Edralzar