Please explain what are these warning by SWIG and how to avoid it?
Warning 503: Can't wrap 'operator ()' unless renamed to a valid identifier.
Warning 503: Can't wrap 'operator =' unless renamed to a valid identifier.
Warning 503: Can't wrap 'operator *' unless renamed to a valid identifier.
The warnings are generated when SWIG generated C++ code is compiled under Android NDK.
Java doesn’t have an equivalent of
operator()oroperator=in the same sense as C++, so there’s no way for SWIG to directly wrap it. Because they might be important you’re shown a warning that explains they’re not being wrapped. (Missingoperator=might be particularly bad sometimes).This code exhibits such a warning when running
swig -Wall -c++ -java:But you can silence the warning and tell SWIG to expose the operator directly as a regular member function by saying something like:
Which results in a function called
something_elsebeing added in place ofoperator()in the generated wrapper.Or you can assert to SWIG that ignoring those is just fine using:
(You can also apply either of those directives less broadly by qualifying the operators with the class names).