SWIG char** to Python list

Chris chrisNOSPAM at spam.com
Fri Apr 29 06:18:14 EDT 2005


Hi

I have a C function that builds a list of null terminated strings:
void buildStringList(char **asStrings, int n);
The number of elements in the list is given in input.

I'd like to have this function available in Python.
I use SWIG but I'm a complete newbie with it.
I've only found an example to convert a Python list to C char**
http://www.swig.org/Doc1.3/Python.html#Python_nn59

I naively replaced typemap(in) by typemap(out) but it doesn't work :
TypeError: argument number 1: a 'char **' is expected, 'list([])' is
received

Do I have to learn more of SWIG or is there a simple way to make my C
function fill a list of Python objects?

Regards
Chris





More information about the Python-list mailing list