I have a function in C++ that takes an array of struct. I want to convert this function to java using SWIG.
Here what I have
structs.h
Expand|Select|Wrap|Line Numbers
- typedef struct myStruct{
- char name;
- int type;
- }
- void Foo( myStruct * mystr){
- //do something
- }
Expand|Select|Wrap|Line Numbers
- #include "structs.h"
- myStruct structTest[5]; //an array
- structTest[0].name="me";
- structTest[0].type='1';
SWIG ...
I included this header in my interface file and it generates all the classes.
.... Here is what I did in my Java driver
Expand|Select|Wrap|Line Numbers
- myStruct jtest=new myStruct();
- jtest.setName("me");
- jtest.setType("1");
- Foo(jtest);
Expand|Select|Wrap|Line Numbers
- myStruct jtest[] = new myStruct();
Regards,
Jazi