SWIG and char* newb questions :)
code_berzerker
emen999 at gmail.com
Tue Jul 29 08:51:49 EDT 2008
Ok I think I got it:
PyObject* myFuncXXX(char* p_1, int p_2, char* p_3, int p_4)
{
int res;
char _host[255] = "";
int _port;
res = funcXXX(p_1, p_2, p_3, p_4, _host, &_port);
PyObject* res1 = PyInt_FromLong(res);
PyObject* res2 = PyString_FromStringAndSize(_host, strlen(_host));
PyObject* res3 = PyInt_FromLong(_port);
PyObject* resTuple = PyTuple_New(3);
PyTuple_SetItem(resTuple, 0, res1);
PyTuple_SetItem(resTuple, 1, res2);
PyTuple_SetItem(resTuple, 2, res3);
return resTuple;
}
It seems to work when I put it into swig's "*.i" file.
me proud of me.self :D
More information about the Python-list
mailing list