I'm not quite sure I understand your ctypes approach perfectly. But I think the difference is: in the Cython version you convert the strings on every function call. In the ctypes version you convert the strings once with `ctypes.c_wchar_p` and then pass the existing object to each function call.
Potentially you could do the same thing in Cython. The easiest way to convert a string to a wchar buffer Python object is probably `array.array('H', s.encode('utf_16'))` or `memoryview(s.encode('utf_16')).cast('H')`. You could then have your functions accept `wchar[::1]` memoryviews (which should match on Windows I think). Alternatively you could just pass the encoded bytes around and cast the pointers, but that's maybe a little less safe.
Although possibly I'm misunderstanding your problem.
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cython-users/740a8b2d-6ceb-43b8-8078-c2ecd9199bfcn%40googlegroups.com.