From: Adriaan R. <re...@as...> - 2009-09-04 11:36:55
|
I have some older code I inherited that was originally used with swig 1.3.24. I am now trying to use it with swig 1.3.35. The project wraps C code for use in Python. The code uses the memmove funcion. It works on the old system and according to the Documentation here: http://www.swig.org/Doc1.3/SWIGDocumentation.html#Library_nn7 | | void memmove(void *ptr, char *s) | Copies all of the string data in s into the memory pointed to by ptr. The string may contain embedded NULL bytes. | The length of the string is implicitly determined in the underlying wrapper code." | On the newer system the code fails with the error: "memmove() takes exactly 3 arguments (2 given)" If I look into cdata.i I see this both in the old 1.3.24 and the new 1.3.35 | | void memmove(void *data, const void *indata, int inlen); | So it seems that the function didn't change. I'm stuck because I can't figure out how "void memmove(void *ptr, char *s)" works on the older system or how to change the Python code to use the newer version. I've also looked in /usr/share/swig/1.3.24/python to see if it might be something specific to that language, nothing special seems to be in pyswigtype.swg or any of the other files. I've also tried searching the bugs database at sourceforge. It seems that there used to be a separate version of memmove that used a char* and didn't need the lenght. It also seems that the documentation in http://www.swig.org/Doc1.3/SWIGDocumentation.html#Library_nn7 has not been updated since that got changed or removed. I've done a search on the internet and this mailing list, and found several others with the same problem, but no replies or solutions: http://www.nabble.com/Using-cdata.i-memmove-function-with-a-Python-string-td22878497.html http://article.gmane.org/gmane.comp.programming.swig/14333/match=memmove http://article.gmane.org/gmane.comp.programming.swig/10700/match=memmove The newer system also uses Python 2.5 instead of 2.4, which might be connected to this issue, as 2.5 contains ctypes, which also has a memmove function, but my knowledge of python doesn't go that far, I'm just mentioning it in case it's relevant. Is there anyone who can confim the documentation is out of date, or that there is a bug so that the function described there no longer works? I'm stuck now, is there anyone who knows how to use memmove in Python when dealing with swig 1.3.35 and higher? Any help is appreciated. Thanks, Adriaan Renting |