Use %inline %{ ... %} around your function. SWIG will add your function directly to the wrapper file as well as add a wrapper function for calling it from python.
On Jul 31, 2012, at 2:04 PM, David Froger wrote: >> 2-that's ok if your C++ deals with arrays but what if I actually want to >> receive the Numpy object so that I can manipulate it directly (or if for >> example the array isn't contiguous in memory) >> >> An"dummy"example of foo function I'd like to wrap: >> >> void FOO::fooNumpy(PyArrayObject *nparray) { >> >> int j; >> for(j=0;j<nparray->nd;j++) { >> printf("Ok array dim %i has length: %i\n",j,nparray->dimensions[j]); >> } >> } ** Bill Spotz ** ** Sandia National Laboratories Voice: (505)845-0170 ** ** P.O. Box 5800 Fax: (505)284-0154 ** ** Albuquerque, NM 87185-0370 Email: wfsp...@sandia.gov ** _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion