I am trying to write a wrapper around a C++ library, and one of the functions I am trying to wrap in Cython has a variable of the form const char**. Apparently, it is impossible to initialize "const char**" from "char**" (see
http://stackoverflow.com/questions/2463473/why-am-i-getting-an-error-converting-a-float-to-const-float), which presents a problem for me, as I am reading in an list of UTF-8 encoded strings from Python (call it x), which I then attempt to convert to char** using malloc and a for loop:
def f(x):
cdef char** a = <char**> malloc(len(x) * sizeof(char*))
for item, index in enumerate(x):
a[index] = item
....
What would the workaround here be? Is there an implementation of const_cast somewhere in libcpp? Thanks.