Seg Fault When Using Ctypes With Python And C++
I am trying to get up and running with using ctypes to call C++ libraries from Python 2.7 on a Linux machine. For the moment, I'm just trying toy examples. I read and was able to r
Solution 1:
In your extern "C"
you declare Foo_new
to take a std::string
argument, however for the code to be callable from Python you have to make it a true C function, which include receiving strings a character pointers. Especially as you actually tells the interpreter to convert your string to a character pointer (that's what the c_char_p
call does).
Post a Comment for "Seg Fault When Using Ctypes With Python And C++"