Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18110

ctypes argument by reference

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <bouleetbil@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.021
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'pointer': 0.05; 'url:py': 0.07; 'python': 0.08; 'none)': 0.09; 'null,': 0.09; 'subject:ctypes': 0.09; 'subject:reference': 0.09; 'def': 0.13; 'skip:f 30': 0.13; '315': 0.16; 'callback': 0.16; 'url:head': 0.16; 'int': 0.18; 'received:74.125.82.174': 0.24; 'code': 0.25; 'pass': 0.29; "i've": 0.31; 'message-id:@gmail.com': 0.33; 'instead': 0.33; 'to:addr:python-list': 0.34; 'backend': 0.34; 'received:74.125.82': 0.35; 'response': 0.35; 'charset:us-ascii': 0.37; 'but': 0.37; 'reference': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'url:org': 0.39; 'should': 0.39; 'to:addr:python.org': 0.40; 'more': 0.61; 'url:p': 0.62; 'url:cgi': 0.64; 'here': 0.65; 'url:a': 0.65; 'url:f': 0.73; '708': 0.84; 'url:lib': 0.84; 'local,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:x-mailer:mime-version:content-type :content-transfer-encoding; bh=eOnarN4YeoFcsyuogkfRz31stBoQ2yXjA6avClUO2BI=; b=LPzA1WE7j5EbWiz1qpCorG4yEZrxEdCr3dcHIMALN5a72/MPCdwlRppsUhUtKmy6Eg BPLFBb2WmI4di3uFocrRBY7TzFdMNFLILq+YIIgPHtV0mc9VsK3FSc1cAKw4Y4CnTgTt VvHweNVm8fLRoijxdZ6yQfNPr7Q6faHI4KAOM=
Date Wed, 28 Dec 2011 08:58:59 +0100
From bouleetbil (gaetan) <bouleetbil@gmail.com>
To python-list@python.org
Subject ctypes argument by reference
X-Mailer Claws Mail 3.7.8 (GTK+ 2.22.0; x86_64-frugalware-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4177.1325060929.27778.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325060929 news.xs4all.nl 6864 [2001:888:2000:d::a6]:54418
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18110

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

ctypes argument by reference bouleetbil (gaetan) <bouleetbil@gmail.com> - 2011-12-28 08:58 +0100

csiph-web