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

Nat Goodspeed ngoodspeed at solidworks.com
Thu Mar 23 14:41:56 CET 2006


> -----Original Message-----
> From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org]
On
> Behalf Of Abhi
> Sent: Wednesday, March 22, 2006 7:59 PM
> To: c++-sig at python.org
> Subject: [C++-sig] converting python list of strings to char *[]
> 
> 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?

[Nat] Depending on how many such functions you have, wouldn't it be
simpler to publish thin wrappers? In this case the run() function you
call from Python would be defined to accept a list of Python strings,
and would then construct both arguments for the real run() function from
that list.

If you have many such functions, is it possible that pyplusplus would
generate such wrappers automatically? (I'm not familiar with pyplusplus
beyond the traffic I've seen here over the past few months.)



More information about the Cplusplus-sig mailing list