[C++-sig] converting python list of strings to char *[]

Abhi abhi at qualcomm.com
Thu Mar 23 01:58:54 CET 2006


I could not find this in the archives.

I have functions such as
int run(int argc, char* argv[])

which needs to be exported to python using Boost.Python.

How do I pass to the char *argv[] from python?
Can I define converter from python list to char *[], so that it works for 
all functions that take char* [] as an argument? Any examples.

Essentially I want the following to work in python

l = ["HI", "HO"]
x = run(2, l)

Is there any way to make sure that the converter will only be triggered 
when I am going from list of strings to char* []

thanks
- Abhi




More information about the Cplusplus-sig mailing list