Original Post
I'm wrapping a c++ function with SWIG. Everything works fine, until I actually use the c++ module I create. When I attempt to call the function in python, I get an error involving one the pointer parameters. Here's all the error and the code:
---- Error ----
TypeError: in method 'particleUpdate', argument 1 of type 'int *'
---- The python test program ----
import particleSys
x = 3
y = 3
lifetime = 10
speed = 1.7
angle = 180
particleSys.particleUpdate(x, y, angle, speed, lifetime)
print x, y, angle, speed, lifetime
---- particleSys.c++ -----
#define PI 3.14159265
void particleUpdate(int *x, int *y, int angle, float speed, int *lifetime)
{
float angleRad = (float)(angle*(PI/180));
int dx = (int)(speed*cos(angleRad));
int dy = (int)(-speed*sin(angleRad));
*x += dx;
*y += dy;
*lifetime--;
} I've been reading on SWIG, and I don't believe that it handles pointer arguments differently than normal ones, so I don't have a clue what the problem is.