[C++-sig] Wrapping std::vector with boost::python::list

2011-08-09 Thread fjanoos
Hello, I'm new to boost::python and was having trouble wrapping a C++ function of the form void FindVCs(int vId, vector& vcs); Here vcs is allocated in the caller and populated by FindVCs. Initially, I considered wrapping it something like this: boost::python::list* FindVCs_wrap(int

[C++-sig] Wrapping std::vector with boost::python::list

2011-08-09 Thread fjanoos
Hello, I'm new to boost::python and was having trouble wrapping a C++ function of the form void FindVCs(int vId, vector& vcs); Here vcs is allocated in the caller and populated by FindVCs. Initially, I considered wrapping it something like this: boost::python::list* FindVCs_wrap(int vi

Re: [C++-sig] Wrapping std::vector with boost::python::list

2011-08-09 Thread Jim Bosch
Just return boost::python::object by value; it's actually a smart pointer that carries a PyObject* and uses Python's reference counting, and you can implicitly create one from boost::python::list (since list derives from object). Just returning boost::python::list by value might also work, but

Re: [C++-sig] Wrapping std::vector with boost::python::list

2011-08-09 Thread Stefan Seefeld
On 08/09/2011 05:17 PM, fjanoos wrote: > Hello, > > I'm new to boost::python and was having trouble wrapping a C++ function of > the form > void FindVCs(int vId, vector& vcs); > > Here vcs is allocated in the caller and populated by FindVCs. Note that this should work, but requires you to instr

[C++-sig] Functions exposed using boost::python not reported by the python profiler

2011-08-09 Thread Arnaud Espanel
Hi -- When running a python program through the python profiler, calls to a function exposed directly through C python api are reported, but not the calls to a function exposed through boost::python. I'd like to see boost::python calls reported on their own as well... but have not managed to. To de

Re: [C++-sig] Functions exposed using boost::python not reported by the python profiler

2011-08-09 Thread Jim Bosch
On 08/09/2011 03:57 PM, Arnaud Espanel wrote: Hi -- When running a python program through the python profiler, calls to a function exposed directly through C python api are reported, but not the calls to a function exposed through boost::python. I'd like to see boost::python calls reported on the

Re: [C++-sig] Functions exposed using boost::python not reported by the python profiler

2011-08-09 Thread Stefan Seefeld
On 08/09/2011 08:23 PM, Jim Bosch wrote: > On 08/09/2011 03:57 PM, Arnaud Espanel wrote: >> Hi -- >> When running a python program through the python profiler, calls to a >> function exposed directly through C python api are reported, but not >> the calls to a function exposed through boost::python

[C++-sig] arguments to c++ functions

2011-08-09 Thread Josh Stratton
Where can I find docs for sending arguments to C\C++ functions? I've followed the hello world example, which seems to automatically convert a python string to a char*, but I'm going to need more conversions later like how to handle a char**. Something like ["a","b","c"] doesn't seem to work.