OK, I looked at the varin, varout descriptions in the online manual,
and they specifically mention global variables, but WOW is that
documentation minimal. I would suggest asking Swig-
[EMAIL PROTECTED] for some assistance.
On Feb 16, 2007, at 1:10 PM, Bill Spotz wrote:
> Andrea,
>
> It is
Andrea,
It is my understanding that swig typemaps only apply to function
arguments. Since what you are talking about is a global variable, I
don't believe typemaps will help you. I would try
%{
#include "header-that-contains-vec.h"
npy_intp vec_dims[ ] = { (npy_intp) length_of_vec };
%}
%re
Il giorno 15/feb/07, alle ore 22:26, Bill Spotz ha scritto:
> It seems to me you would need to %ignore vec, so that it is not
> wrapped as a raw pointer to a double, and then in your interface
> file create a PyArrayObject whose data buffer points to vec (the
> most efficient way to do this
It seems to me you would need to %ignore vec, so that it is not
wrapped as a raw pointer to a double, and then in your interface file
create a PyArrayObject whose data buffer points to vec (the most
efficient way to do this is with %inline). Then use %rename to
rename whatever you called y
Hi,
I need to pass a Numpy array to a C code wrapped by Swig.
The array in the C code is a global variable declared as
double *vec
and I would like to set it in the calling Python module foo using e.g.
foo.cvar.vec = numpy.zeros(10)
so that the array is manipulated in place.
I found out the exampl