java - Mapping of type: char**& in JNA -


my client gave me dll couple of functions. 1 of them is:

int getversions(char* name, char** &pversions); 

it returns number of versions given name , array of strings versions. using jna, i'm trying write equivalent java method in interface:

int getversions(string name, string ll, ??? pversions); 

the problem type should instead of ??? ?

i trying put there pointerbyreference , after method invocation had:

pointer ptr = ptrref.getvalue(); string ppp = ptr.getstringarray(0); 

but got here invalid memory access.

pointer ptr = ptrref.getvalue(); string ppp = ptr.getstring(0, "utf-8"); 

returns garbage.

any idea how solve it?

thanks in advance!

the char ** mapping pointerbyreference. example.

c code.

char **xs_directory(struct xs_handle *h, uint32_t t,const char *path, unsigned int *num);

jna:

pointerbyreference xs_directory(xenstorelibrary.xs_handle h, int t, string path, intbuffer num);

this xenstore api contents of directory,the num pointerbyreference pointer count. use code pointer value.

pointerbyreference pbr = xenstorelibrary.instance.xs_directory(xs_handle, tran, "/local/domain/0", intbuffer);

    int n = intbuffer.get();      pointer[] arrays = pbr.getpointer().getpointerarray(0,n);      (int = 0; < arrays.length; i++) {          pointer array = arrays[i];          system.out.println(array.getstring(0));      } 

sorry poor english.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -