I work with ctypes using C ++ as a backend. Now in C ++ there is such a function:
void HandleString(std::string something){ ... }
I am wondering how to call this function from python - there is no ctype (c_char_p wont work explicitly) to send a string parameter to this function ...
How can I fix this and pass a string from Python to C ++ (and change the parameter to char * something is wrong and an option)
PS Can I create a workaround like this?
- send the python string as c_char_p to a C ++ function that converts char * to std :: string
- return the string or its pointer somehow ??? !! (how?) in python
- send it using the python function in HandleString (but again it seems to me that I need to change the parameter to the string * here)
source share