Generated code
static uint8* *copy_uint8pp(uint8* value) {
return (new uint8*(static_cast< const uint8*& >(value)));
}
is invalid (clang error):
error: non-const lvalue reference to type 'const uint8 *' (aka 'const unsigned char *') cannot bind to a value of unrelated type 'uint8 *' (aka 'unsigned char *')
return (new uint8*(static_cast< const uint8*& >(value)));
^ ~~~~~
error: cannot initialize a new value of type 'uint8 *' (aka 'unsigned char *') with an lvalue of type 'const uint8 *' (aka 'const unsigned char *')
return (new uint8*(static_cast< const uint8*& >(value)));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
called from cpointer.i:
%define %pointer_functions(TYPE,NAME)
...
static TYPE *copy_##NAME(TYPE value) { return %new_copy(value, TYPE); }
when wrapping
f(uint8* source, int file_size, int* width, int* height, uint8** dest)
Fix by
==== Lib/typemaps/swigmacros.swg - my/Lib/typemaps/swigmacros.swg ====
161c161
< # define %new_copy(val,Type...) (new Type(%static_cast(val, const Type&)))
---
> # define %new_copy(val,Type...) (new Type(%static_cast(val, Type const&)))
I've managed to piece together a complete testcase which reproduces the issue here with current git master:
The documentation in Library.html for
%pointer_functions
says: "When using this macro,type
may be any type", sotype
being a pointer type should be supported.