This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Alex Wang
Recipients Alex Wang, docs@python, eryksun
Date 2016-11-15.19:24:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CABs28K+HstwaoFEc_9+S5metfVnu-xYfVdC6D98VT5jS1F+=6g@mail.gmail.com>
In-reply-to <1479236277.21.0.0574855895966.issue28698@psf.upfronthosting.co.za>
Content
Hi Eryk,

Thanks a lot for quick reply~

This is about the bug I filed: http://bugs.python.org/issue28698#

I may still need your help to have a look the original case when I caught
this issue:

​I am writing some test automation which call C DLL from Python, the C
function is something like:

MEASURE_API int InitTester(char *ipAddress)

​So I need to pass an IP address string (for example, 192.168.100.100) from
Python in ctypes to this function. For non-const char in C, I used

c_ipAddress = create_string_buffer(b'192.168.100.100')
lib.InitTester(c_ipAddress)

​But error code returned indicate that the parameter passing is incorrect,
then I traced back and found then reported the c_char_p/c_wchar_p issue.​

Also tried
​c_ipAddress = create_unicode_buffer('192.168.100.100')
c_ipAddress = c_char_p(b'192.168.100.100')
c_ipAddress = c_wchar_p('192.168.100.100')​

​But none of them working... I had called other function to this C DLL
passing c_int(). c_bool(), c_void_p() and etc. they are all working as
expected, only string related have this issue.

Therefore, any idea how write the correct assignment and pass it to ​C DLL
for this case in Python 3.5? Any hint would be great helpful.

Thank you in advance~

BR,
Alex

On Tue, Nov 15, 2016 at 10:57 AM, Eryk Sun <report@bugs.python.org> wrote:

>
> Changes by Eryk Sun <eryksun+pybugs@gmail.com>:
>
>
> ----------
> keywords: +easy
> stage:  -> needs patch
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue28698>
> _______________________________________
>
History
Date User Action Args
2016-11-15 19:24:19Alex Wangsetrecipients: + Alex Wang, docs@python
2016-11-15 19:24:19Alex Wanglinkissue28698 messages
2016-11-15 19:24:18Alex Wangcreate