Re: SWIG and char* newb questions :)

2008-07-29 Thread Stefan Behnel
code_berzerker wrote: > Hi i'm relatively new to Python and my C/C++ knowledge is near to > None. Having said that I feel justified to ask stupid questions :) Have you considered using Cython? It's almost Python, but it compiles to C code for a Python extension module and even lets you call C func

Re: SWIG and char* newb questions :)

2008-07-29 Thread code_berzerker
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)); Py

Re: SWIG and char* newb questions :)

2008-07-29 Thread Heiko Wundram
Am Dienstag, 29. Juli 2008 12:51:36 schrieb code_berzerker: > Ok now more seriously. I have question refering to char* used as > function parameters to return values. I have read SWIG manual to find > best way to overcome that, but there are many warnings about memory > leaks and stuff, so I feel c

SWIG and char* newb questions :)

2008-07-29 Thread code_berzerker
Hi i'm relatively new to Python and my C/C++ knowledge is near to None. Having said that I feel justified to ask stupid questions :) Ok now more seriously. I have question refering to char* used as function parameters to return values. I have read SWIG manual to find best way to overcome that, but