I have a small with INPUT keyword in interface file . and then using the swig to generate the code C to python . And call python function to call C function .
But I has a issue :
xxxxx ....argument 1 of type 'char'
---------------------------
I don't know the reason .. Please help
attachment sample
I think you're just getting what you asked for (which isn't what you wanted):
int insert(char *INPUT);
This tells SWIG that
insert
takes a singlechar
as input, and it's passed as a pointer to that single char.I assume what you're wanting is to tell SWIG the functions take a string and doesn't modified it - i.e. to effectively pretend the parameter is
const char*
notchar *
.Doing exactly that works, though gives a compiler warning:
The better approach is to tell SWIG to apply the typemaps for
const char*
here:Usage error rather than a bug, so closing.