I'm working with an existing module at the moment that provides a C++ interface and does a few operations with strings.
I needed to use Unicode strings and the module unfortunately didn't have any support for a Unicode interface, so I wrote an extra function to add to the interface:
void SomeUnicodeFunction(const wchar_t* string)
However, when I attempt to use the following code in Python:
SomeModule.SomeUnicodeFunction(ctypes.c_wchar_p(unicode_string))
I get this error:
ArgumentError: Python argument types in
SomeModule.SomeUnicodeFunction(SomeModule, c_wchar_p)
did not match C++ signature:
SomeUnicodeFunction(... {lvalue}, wchar_t const*)
(names have been changed).
I've tried changing wchar_t in the C++ module to Py_UNICODE with no success. How do I solve this problem?