Working char ** variables

Ervin Hegedüs <[email protected]>
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
Hi there,

I have a global variable with list of C strings:

char ** custom_variables;

with a method to append a new item to the end:

void add_item_to_array(char *** arr, char * item);

(this is how I call it:
  add_item_to_array(&custom_variables, "foo")
)

I can access this variable in Python, and what I set I can see in
the running code, eg:

mytest.cvar.custom_variables = ["Foo", "bar"]

and I get what I want.


I'd like to use that list with .append() method, so I think I
have two ways - but I don't know the first (use list.append()),
and the second (use
mytest.add_item_to_array(mytest.cvar.custom_variable, "foo"))
drops an error:


Traceback (most recent call last):
  File "./py3test.py", line 52, in <module>
    mytest.add_item_to_array(mytest.cvar.custom_variables, "FooBar")
  File "../../mytest.py", line 207, in add_item_to_array
    return _mytest.add_item_to_array(arr, item)
TypeError: in method 'add_item_to_array', argument 1 of type 'char ***'


Which typemap have to I use and how?


Thanks,



a.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.