ctypes argument by reference
bouleetbil (gaetan)
bouleetbil at gmail.com
Wed Dec 28 02:58:59 EST 2011
Hi
I try to write a python backend for pamcan-g2, for that I should write a callback for *trans_cb_conv
In python I've write :
trans_cb_event = CFUNCTYPE(ctypes.c_char_p,ctypes.c_void_p,POINTER(ctypes.c_int)
...
def fpm_trans_conv(event,pkg,response):
foo...
response=1
and for call the callback
if trans_init(pm_trans,flags, trans_cb_event(fpm_progress_event), trans_cb_conv(fpm_trans_conv), None) == -1 :
foo...
Into libpacman response is a C int pointer :
...
QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
...
but resp=0 howto pass response by reference instead by value ?
If you would more informations/code :
the .h is here : http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=blob_plain;f=lib/libpacman/pacman.h;hb=HEAD
the python code here : http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=blob_plain;f=py-pacman/py-pacman.py;hb=4abed4ee445f009387a3a51957e231c010c123bb
trans_cb_event line 315
fpm_trans_conv line 676
pacman_trans_init callback 708
More information about the Python-list
mailing list