A
Anand
I have a C extension to a dll function.
static PyObject *_wrap_SetTxCommandRegister(PyObject *self, PyObject
*args) {
PyObject *resultobj;
int arg1 ;
int arg2 ;
int arg3 ;
char *arg4 = (char *)"Python" ;
err result;
if(!PyArg_ParseTuple(args,(char
*)"iii|s:SetTxCommandRegister",&arg1,&arg2,&arg3,&arg4)) goto fail;
result = (err)SetTxCommandRegister(arg1,arg2,arg3,(char const
*)arg4);
resultobj = PyInt_FromLong((long)result);
return resultobj;
fail:
return NULL;
}
Now here is what i pass from python
test = [0xff,0xaf,0xf0]
newint = test[0]
SetTxCommandRegister(0xff,test[1],test[2])
print test
arg1 = 0xaf if i pass either test[0] or newint
arg1 = 0xff if i pass constant like what i have shown in the code
What am i doing wrong?
Thanks in advance
Anand
static PyObject *_wrap_SetTxCommandRegister(PyObject *self, PyObject
*args) {
PyObject *resultobj;
int arg1 ;
int arg2 ;
int arg3 ;
char *arg4 = (char *)"Python" ;
err result;
if(!PyArg_ParseTuple(args,(char
*)"iii|s:SetTxCommandRegister",&arg1,&arg2,&arg3,&arg4)) goto fail;
result = (err)SetTxCommandRegister(arg1,arg2,arg3,(char const
*)arg4);
resultobj = PyInt_FromLong((long)result);
return resultobj;
fail:
return NULL;
}
Now here is what i pass from python
test = [0xff,0xaf,0xf0]
newint = test[0]
SetTxCommandRegister(0xff,test[1],test[2])
print test
arg1 = 0xaf if i pass either test[0] or newint
arg1 = 0xff if i pass constant like what i have shown in the code
What am i doing wrong?
Thanks in advance
Anand