2012/7/30 David Froger <david.froger@gmail.com>
> But another question:  Do you want the C++ array to be copied in the numpy array
> (safe,  ARGOUT_ARRAY1 + a helper function  should words),  or the numpy array to
> point on the  C++ array (hard to  make it safe,  only required is  array is very
> big and can not be duplicated, ARGOUTVIEW_ARRAY1 should works) ?

It may rather be this third case :  the array will no more be accessed from C++,
and we  just want the  data to exists in  the numpy array,  which  can be safely
destroy by Python.  So the C++ function  allocates the array with size not known
by the caller, and the caller is responsible to delete the array.  If C++ is the
caller,  a (double  *array,  int size) is  returned,  (and because there  is two
returned values, there are returned using arguments, so actually double **array,
int *size), and if Python is the caller,  (double *array, int size) is converted
to a numpy array by the typemap.

Hmm, you lost me on this third case. Python is the caller, C++ is responsible for the array creation and initialization and should then pass it (preferably in a safe manner) to numpy/python. Once that's done, C++ no longer needs to take care of the array, so a copy (as in your "other question") would be sufficient, the array is not that large. Which helper function are you thinking of?