1

I have a function in C which takes in a double pointer to a typedef struct as an argument. say for example

void func (my_struct ** example){...};

When I am using swig to generate the corresponding code in java, it is generating a SWIGTYPE_p_p_my_struct class. I wanted to know how to access the elements of the struct using this class, and instantiate an object of this class. Also, what do I need to include in the interface file.

Currently I am using the below line at the end of the interface file -

%pointer_functions(my_struct, my_struct_p);
ci_
  • 8,594
  • 10
  • 39
  • 63
coderror
  • 11
  • 1
  • What you do with cases like this depends entirely on the semantics of the C function and the desired semantics for your Java. Does this function create a new instance of my_struct by any chance and store it in the pointer pointed to by example? Most likely you're looking at the exact same usage scenario as my answer here: http://stackoverflow.com/a/12767656/168175 – Flexo Aug 22 '15 at 14:08
  • Actually http://stackoverflow.com/a/14427814/168175 or http://stackoverflow.com/a/30360180/168175 might be better examples – Flexo Aug 22 '15 at 14:19

0 Answers0