Let's say I have a class A and class B such that class B has a method that looks like:
B* create(const A& a, int c){...}
an acceptable type of A is also a string, for example, I can call:
B::create("hello", 5);
and it'll be accepted in the C++ interface and work fine!
My problem here is that while wrapping class B with SWIG I want to be able to call create in Python just like in the c++ interface, for example:
B.create('hello', 5)
but for that I think I need a typemap, because right now I'm getting an error that says:
TypeError: in method 'B_create', argument 1 of type 'A const &'
How can I typemap it correctly? Tried:
%typemap(in) const A& = const char*;
But It's not working (I assume because I don't really get the documentation about typemapping)
I found this StackOverflow thread: How to use Swig to treat a void * function parameter as Python string and tried it myself:
%typemap(in) const A& = char*; but it gives me a segmentation fault.