The following results in gcc 4.01 reporting "error: invalid conversion from ‘const char*’ to ‘char*’" when using Cython 0.9.8
test.pyx:
cdef extern from "test.h":
ctypedef struct c_Test "Test":
char *getString() except +RuntimeError
## All OK if no 'except +RuntimeError'
cdef class Test:
cdef c_Test *thisptr
def getString(self):
return self.thisptr.getString()
test.h:
static const char *astring = "123" ;
class Test {
public:
const char *getString(void) { return astring ; }
} ;
setup.py:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
name = 'biosigpy',
ext_modules = [
Extension('test', ['test.pyx'],
language='c++',
extra_link_args=["-g"],
)
],
cmdclass = {'build_ext': build_ext}
)