SWIG char** to Python list

Discussion in 'Python' started by Chris, Apr 29, 2005.

  1. Chris

    Chris Guest

    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
    Chris, Apr 29, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wwj
    Replies:
    7
    Views:
    542
  2. wwj
    Replies:
    24
    Views:
    2,484
    Mike Wahler
    Nov 7, 2003
  3. Rick Olson
    Replies:
    0
    Views:
    440
    Rick Olson
    Jan 9, 2004
  4. lovecreatesbeauty
    Replies:
    1
    Views:
    1,015
    Ian Collins
    May 9, 2006
  5. ObiWanKinobi
    Replies:
    0
    Views:
    694
    ObiWanKinobi
    Jun 6, 2010
Loading...

Share This Page