Python 3.x ctype c_wchar_p and c_char_p return status different from ctypes doc
<h3>Python Version</h3>

<p>Python 3.5.2</p>

<h3>Issue</h3>

<p>I notice this issue when I tried to call the C DLL using ctypes, the C function is something like:</p>

<pre><code>MEASURE_API int InitTester(char *ipAddress)
</code></pre>

<p>So I need to pass an IP address string (for example, 192.168.100.100) from Python to ctypes, according to <a href="https://docs.python.org/3/library/ctypes.html" rel="nofollow noreferrer">ctypes doc</a> of Python 3.5, I tried both <a href="https://docs.python.org/3/library/ctypes.html#ctypes.c_wchar_p" rel="nofollow noreferrer">c_wchar_p</a> and c_char_p, but none of them working, I got error code retrun from c dll side. I had some other function call to this dll passing c_int, c_void_p, c_bool and other data types which are all ok. Traced back and found that the c_wchar_p and c_char_p return results behaves different from what it should be based on ctypes doc. From the ctypes doc of Python 3.5:</p>

<pre><code>&gt;&gt;&gt; c_wchar_p("Hello, World")
c_wchar_p('Hello, World')
</code></pre>

<p>It return the ctypes string.
But my results of execute the same cmd in Python console:</p>

<pre><code>&gt;&gt;&gt; from ctypes import *
&gt;&gt;&gt; c_wchar_p("Hello, World")
c_wchar_p(1374004842736)
&gt;&gt;&gt; c_wchar_p("Hello, World")
c_wchar_p(1374004841680)
&gt;&gt;&gt; c_wchar_p("Hello, World")
c_wchar_p(1374004842736)
</code></pre>

<p>So seems like the orignial string part becomes memory address maybe. Digged in more, and found out if it is Python 2.x(default encoding is ASCII), then the return shows the string like the Python 3.5 ctypes doc shows. But in Python 3.x(default encoding is UTF-8), it always return numbers, behave differnt from the doc. Checked on multiple PCs. And understood the part that, we can use .value to return the original string. But it could not pass to the C function which has to be a ctype.</p>

<h3>Question</h3>

<ul>
<li>Can anyone provide a explaination about this about behavior ctypes?</li>
<li>and how to resolve this, so that I could get the same behave like ctype doc in Python3.5 and then make the call c dll work?</li>
</ul>

<p>Thanks a lot in advance~</p>