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

Roman Yakovenko roman.yakovenko at gmail.com
Thu Mar 23 20:18:31 CET 2006


On 3/23/06, Abhi <abhi at qualcomm.com> wrote:
> >> 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.
>
> [Abhi] That's what I did: wrapped individual functions. But now we have
> quite a few more and it will be easier to just do it for the type: convert
> a list of string to char *[]. Is that possible? I was looking at the
> boost.python reference manual online, but did not see any examples.

I don't know whether this is possible or not. May I give you small tip?
You don't have to use any code generator, you can create your own one. It will
treat only this case. This is a task for 1 -2  hours only. Take a look
on pygccxml.
It has all tools to build this solution.

http://www.language-binding.net/pygccxml/pygccxml.html

> thanks
> - Abhi

--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list