[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2016-08-03 Thread Vinay Sajip
Vinay Sajip added the comment: I'm closing this as a duplicate of issue 20160 - it appears to be the same bug. -- resolution: -> duplicate stage: test needed -> resolved status: open -> closed superseder: -> broken ctypes calling convention on MSVC / 64-bit Windows (large structs) __

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2016-07-21 Thread Patrick Stewart
Patrick Stewart added the comment: I've attached a patch with an extra fix to the duplicated issue 20160 http://bugs.python.org/issue20160 -- ___ Python tracker ___

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2016-07-20 Thread Patrick Stewart
Patrick Stewart added the comment: This also fixes python 3.5 -- nosy: +Patrick Stewart ___ Python tracker ___ ___ Python-bugs-list ma

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2015-06-10 Thread Vinay Sajip
Vinay Sajip added the comment: I can confirm that the CFFI patch works as expected on Python 2.7.10. -- stage: -> test needed versions: +Python 3.4, Python 3.5, Python 3.6 ___ Python tracker __

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2015-06-10 Thread Vinay Sajip
Vinay Sajip added the comment: I note that the code for CFFI has a fix in ffi_prep_incoming_args_SYSV, as follows: #ifdef _WIN64 if (z > 8) { /* On Win64, if a single argument takes more than 8 bytes, then it is always passed by reference. */ *p_ar

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2015-06-10 Thread Vinay Sajip
Vinay Sajip added the comment: Although Matt was able to work around his problem, this problem seems to still be present in 2.7 as well as all 3.x versions. I think I've found the cause of the problem: in 64-bit code, the calling conventions for passing structures by value are different. From

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2013-04-23 Thread Matt Clarke
Matt Clarke added the comment: It seems that any argument greater than 8 bytes is automatically converted to a references. Thus, changing to using ctypes.POINTER works. For example: callback_t = ctypes.CFUNCTYPE(None, ctypes.POINTER(myst_args)) Quite a simple solution in the end. Is it worth do

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2013-03-18 Thread Matt Clarke
Matt Clarke added the comment: Hi Amaury. They are both 12 bytes. Matt -- ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2013-03-18 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Sorry, I asked the wrong question; callback_t is a function pointer, so 8 bytes is expected. What is sizeof(myst_args) both in C and Python? -- ___ Python tracker __

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2013-03-18 Thread Matt Clarke
Matt Clarke added the comment: Hi Amaury. I have tried removing pack and using /Zp1, but it makes no difference. The size of callback_t and the one in C are 8 bytes. Thanks, Matt On 13 March 2013 13:19, Amaury Forgeot d'Arc wrote: > > Amaury Forgeot d'Arc added the comment: > > Is "_pack_ =

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2013-03-13 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Is "_pack_ = 1" correct? Did you compile your C library with /Zp1 or similar? Also check that ctypes.sizeof(callback_t) matches the one given by the C compiler. -- ___ Python tracker

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2013-03-01 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- nosy: +amaury.forgeotdarc, meador.inge ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2013-02-27 Thread Matt Clarke
New submission from Matt Clarke: I have had an issue arise with ctypes callbacks with 64bit Python on Windows. Note: everything works fine with 32bit Python on Windows and on 32bit and 64bit Linux. I have created a simple example to illustrate the issue I have (see attachment), but the real-li