From: William S F. <ws...@fu...> - 2011-11-30 20:24:52
|
On 22/11/11 23:44, colin gray wrote: > Hello > > I hava a SWIG interface file that exposes some C functions (via JNI) to > my Java application and these C structures are used as input into the C > function (via SWIG/JNI). SWIG generates the structure as a Java class, > but I'm unsure how to set the structures properties as the setters take > a SWIG generated type. I need to set the structures properties before > passing it as input into the C function from my Java class. > example_location_id_t_ is the class I need to pass, but the setters > for **Id** and **Phy_idx** take the below SWIG types. How do I populate > the SWIGTYPE_p_unsigned_char and SWIGTYPE_p_uint32_t so that I can set > the Id and Phy_idx propertys of the SWIGTYPE_p_uint32_t class? > > setId(SWIGTYPE_p_unsigned_char value) and setPhy_idx(SWIGTYPE_p_uint32_t > value) > The type wrapper classes are a kind of warning that you need to improve the wrappers. Perhaps you need to apply the const ref typemaps, hard to tell without seeing your C++ source. If the types are pointers you have numerous choices as to how to handle them, but that depends on what the C++ interface requires, which cannot be automatically deduced by SWIG when parsing the headers. William |