Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SWIG char** to Python list

Reply
Thread Tools

SWIG char** to Python list

 
 
Chris
Guest
Posts: n/a
 
      04-29-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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use list type generated by SWIG? Bryan Python 0 01-10-2010 08:21 PM
SWIG -- Passing python proxy class instance to python callback Keith Sabine Python 0 06-06-2008 03:52 PM
swig %typemap generated list typeerror txtoth@gmail.com Python 0 05-14-2007 09:30 PM
SWIG -- Passing python proxy class instance to python callback Jeff Python 0 05-02-2005 02:55 PM
swig and list in python =?iso-8859-2?q?Bo=B9tjan_Jerko?= Python 1 06-02-2004 12:21 PM



Advertisments