[C++-sig] Simply calling a routine ...

Charles Leung cleung at eos.ubc.ca
Fri Jun 27 23:02:06 CEST 2003

Hi Christophe,

We've previously implemented a Numeric array wrapper, num_util, available
for download at:


Feel free to give it a try ;-)

This wrapper generally works with Boost's numeric::array class. It allows
users to access certain array properties and to instantiate Python numeric
array in C++. There are some example usage in the num_test.cpp file.

Your example, utilizing num_util, will probably look something like...

namespace nbpl = num_util;
namespace py = boost::python;

py::long_ foo( py::numeric::array a, float b,
               py::numeric::array c, int N ){
	Array<short, 1> A(N);
 	A.data() = (short*) nbpl::data(a);

 	// Do some work

 	return ( py::long_(ERROR_CODE) );

I hope this helps.


More information about the Cplusplus-sig mailing list