Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'interpreter': 0.05; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'subject:Help': 0.11; 'thread': 0.14; 'cc:name:python list': 0.16; 'python/c': 0.16; 'subject:ctypes': 0.16; '(you': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'properly': 0.19; 'example': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; '>': 0.26; 'handling': 0.26; 'least': 0.26; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; 'code': 0.31; 'boundary': 0.31; 'ctypes': 0.31; 'writes:': 0.31; 'skip:& 30': 0.33; 'subject:with': 0.35; 'good.': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'too': 0.37; 'skip:& 10': 0.38; 'e.g.': 0.38; 'pm,': 0.38; 'environment.': 0.39; 'new': 0.61; 'great': 0.65; 'safer': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=0ZQKhQN1yRHVYGGUi0ZqJtjo4d35wumqQsfi4IljjyU=; b=Q4dW2sWTGfWjK2jsLF+JljtFsWQmy5FhDPRapMrdndH7MU++y5iTmu2LiokGlGxzJp jb8ueBnLPLt+ZRdVhZEPnZc+0PF5h7M2dwjib0IbO+27/ObCDXLQwPyhQfG27/YyCE3U dbO7u8+nJy5/3Ix5DdeFiCUpsWYNOfJnHQpLc+XYuOi2vYCpbU8V72x29j9bCIYZp2pP GCls4oel8lbi1Bh/UURjwe3CGKqk92BPGkcSXnHZhW6yn4jTBThDgTXbpugcPSQ3bD5R 9BTgfYyoGsAm6eMjHe2fM0EISv6R/TVY3wtyvtbFN3Kobwk7CA9W4rgeDzkXe97qq2Cu 4V/Q== MIME-Version: 1.0 X-Received: by 10.224.39.77 with SMTP id f13mr14408561qae.96.1369365988136; Thu, 23 May 2013 20:26:28 -0700 (PDT) In-Reply-To: <87mws4bsum.fsf@handshake.de> References: <8931a89c-0d00-4c8b-ba19-cf683d8d266d@googlegroups.com> <87mws4bsum.fsf@handshake.de> Date: Thu, 23 May 2013 20:26:28 -0700 Subject: Re: Help with implementing callback functions using ctypes From: Dan Stromberg To: dieter Content-Type: multipart/alternative; boundary=20cf3074d9264a78b304dd6e5de6 Cc: Python List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369365991 news.xs4all.nl 15888 [2001:888:2000:d::a6]:34219 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45865 --20cf3074d9264a78b304dd6e5de6 Content-Type: text/plain; charset=ISO-8859-1 On Wed, May 8, 2013 at 10:54 PM, dieter wrote: > jamadagni writes: > > ... > I cannot help you with "ctypes". But, if you might be able to use > "cython", then calling callbacks is not too difficult > (you can find an example in e.g. my "dm.xmlsec.binding"). > > Note, however, that properly handling the GIL ("Global Interpreter Lock") > may be of great importance when the Python/C boundary is crossed -- > at least when you intend to use your code in a multi thread environment. > Cython is good. So is the new cffi, which might be thought of as a safer (API-level) version of ctypes (which is ABI-level). --20cf3074d9264a78b304dd6e5de6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

= On Wed, May 8, 2013 at 10:54 PM, dieter <dieter@handshake.de> wrote:
jamadagni <samjnaa@gmail.com> writes:
> ...
I cannot help you with "ctypes". But, if you might be able to use=
"cython", then calling callbacks is not too difficult
(you can find an example in e.g. my "dm.xmlsec.binding").

Note, however, that properly handling the GIL ("Global Interpreter Loc= k")
may be of great importance when the Python/C boundary is crossed --
at least when you intend to use your code in a multi thread environment.
=

Cython is good.

So is the new cffi, w= hich might be thought of as a safer (API-level) version of ctypes (which is= ABI-level).

--20cf3074d9264a78b304dd6e5de6--