Problem with number/type of arguments passed to an overloaded c++ constructor wrapped with swig.
- by MiKo
I am trying to wrap a c++ class (let's call it "Spam") written by someone else with swig to expose it to Python.
After solving several problems, I am able to import the module in python, but when I try to create an object of such class I obtain the following error:
foo = Spam.Spam('abc',3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Spam.py", line 96, in __init__
this = _Spam.new_Spam(*args)
NotImplementedError: Wrong number of arguments for overloaded function 'new_Spam'.
Possible C/C++ prototypes are:
Spam(unsigned char *,unsigned long,bool,unsigned int,SSTree::io_action,char const *)
Spam(unsigned char *,unsigned long,bool,unsigned int,SSTree::io_action)
Spam(unsigned char *,unsigned long,bool,unsigned int)
Spam(unsigned char *,unsigned long,bool)
Spam(unsigned char *,unsigned long)
Googling around, I realized that the error is probably caused by the type of the arguments and not by the number (which is quite confusing), but I still cannot identify. I suspect the problem lies in passing a string as the first argument, but have no idea on how to fix it (keep in mind that I know almost no c/c++).