Problem with simple C extension
harold fellermann
harold.fellermann at upf.edu
Tue Jun 14 13:08:43 EDT 2005
On 14.06.2005, at 18:58, harold fellermann wrote:
> Am I stupid or what?
Yes I was ...
> // PhysicsDPD instance structure
> typedef struct {
> PyObject_HEAD
> double cutoff;
> double friction;
> double noise;
> double dt;
> } hyper_PhysicsDPD;
>
>
> //--------------------------------------------------------------------
> // tp_init
> //--------------------------------------------------------------------
> static int
> hyper_PhysicsDPD_init(hyper_PhysicsDPD *self, PyObject *args, PyObject
> *kwds)
> {
> if (!PyArg_ParseTuple(args,"ffff",
> &self->cutoff,
> &self->friction,
> &self->noise,
> &self->dt
> ))
> return -1;
>
> printf("%f %f %f
> %f\n",self->cutoff,self->friction,self->noise,self->dt);
>
> return 1;
> }
format string must be "dddd" - as the members are defined as doubles,
not floats. Sorry to bother you.
- harold -
--
A country without army is like a fish without bicycle.
--
More information about the Python-list
mailing list