Re: [ctypes-users] Memory fault using callable restype
Brought to you by:
theller
From: Chris L. <cli...@gm...> - 2003-07-31 20:17:18
|
Barry, Bob wrote: > 1) With high transaction volume, we always get a memory fault=20 > (segmentation violation) or (once) an illegal instruction. When we=20 > stopped using callable restypes, the problem stopped. Our application i= s=20 > multi-threaded, with ctypes calls in two threads, so perhaps callable=20 > restypes aren=92t thread-safe? This is on a SunOS 5.8. Of course using = a=20 > callable restype is not a necessity. with "callable restypes" you mean that (snippet from the tutorial): >>> def ValidHandle(value): ... if value =3D=3D 0: ... raise WinError() ... return value ... >>> >>> GetModuleHandle.restype =3D ValidHandle hm. i dont use those, but i also experienced crashes with callbacks and=20 threads, see my last post from today. i wrote a little py extensions for the callbacks and that seems to solve=20 the crashes in our system, altough it would be nice if it would work=20 with ctypes only. > 2) What should the restype of a void callback function be? I=92m using=20 > c_int for those (as well as other void functions by default) without=20 > problem, but would like to be certain. i do the same. would be interesting to know... chris |