I want to access a template List of C++ program from a Perl script and use those values.
Example code:
typedef list < Struct1 * > sturct1_list;
struct Struct2
{
int i;
struct1_list List1;
}
struct Struct1
{
int j;
}
I used one swig generated api and did the following:
$myList = Struct2_struct1List_get
print "Reference type: " . ref($myList) ;
now this prints as:
Reference type: \_p\_std\_\_listTutils\_\_Struct1\_p\_t
how to get the values from the structure using this?
Update from duplicate question:
in interface file i put
%template(ListStruct1) std::list< Struct1 * >;
after i generate the ".pm" file. I checked the APIs available this list.
I found
ListStuct1_size
ListStuct1_empty
ListStuct1_clear
ListStuct1_push.
I was able to use those elements. But i dont know how to access individual elements of the list using these API? or am I missing something in interface file?
UPDATED:
Is typemap possible to return the list as array here??