[C++-sig] (Stefan Seefeld) pass function pointerto c

Stefan Seefeld seefeld at sympatico.ca
Mon Oct 9 18:06:14 CEST 2006


Qinfeng(Javen) Shi wrote:
> Hi Stefan,
> 
> Thanks very much.
> 
>> make that
>> float f = boost::python::extract<float>(rlt);
>> Would that work ?
> It works if arg_op = plus or minus. ( here process(boost::python::object
> arg_op)).
> But it didn't work if arg_op = vectorPlus. It seems that arg_op can't
> accept
> a c++ float pointer.

Python has no notion of pointer. So, the float * is accepted, but
that's because for convenience the boost.python side accepts it as a
pointer to a single item. You can't pass arrays like that.
(You may want to look at http://boost.org/libs/python/doc/v2/indexing.html
to see how you can export containers.)

Regards,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list