From: Nitro <ni...@dr...> - 2006-07-17 14:26:48
|
Am 17.07.2006, 15:58 Uhr, schrieb Fabio Mancinelli <Fab...@pp...>: > Hello all, > > I want to use some rpmlib functionalities from Java but I don't know how > to > handle some parameter passing stuff. > > I generated the SWIG wrappers by simply creating an interface file which > directly includes rpmlib.h and I followed the tutorial to compile them. > > Now I wanted to call some functions to check if everything works. I > chose a > function whose C prototype is the following: > > void rpmGetOsInfo(const char ** name, int * num); > > Here I should allocate a memory area consisting of chars for storing the > name > and pass a pointer to that area. And that's fine... In C! :) > > Going to the Java generated code I see that the corresponding method is: > > public static void rpmGetOsInfo(SWIGTYPE_p_p_char name, SWIGTYPE_p_int > num) > > Looking at the SWIGTYPE_p_p_char I expected something like a constructor > to a > SWIGTYPE_p_char which has, in turn, another constructor that takes > either a > char[] or a StringBuffer but... I don't see anything of what I imagined! > I > only see long args! > > So the question is... How do I correctly allocate that buffer in order to > succesfully call the rpmGetOsInfo method? > > Thanks. http://www.swig.org/Doc1.3/Java.html#converting_java_string_arrays |