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


Groups > comp.lang.python > #45052

Re: Help with implementing callback functions using ctypes

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.news.ox.ac.uk!news.ox.ac.uk!zen.net.uk!hamilton.zen.co.uk!reader01.nrc01.news.zen.net.uk.POSTED!not-for-mail
From Nobody <nobody@nowhere.com>
Subject Re: Help with implementing callback functions using ctypes
Date Thu, 09 May 2013 19:32:08 +0100
User-Agent Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
Message-Id <pan.2013.05.09.18.32.14.40000@nowhere.com>
Newsgroups comp.lang.python
References <8931a89c-0d00-4c8b-ba19-cf683d8d266d@googlegroups.com>
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Lines 18
Organization Zen Internet
NNTP-Posting-Host 3109961c.news.zen.co.uk
X-Trace DXC=;?L8^0]@`=g=5nNoc]7<Ufa0UP_O8AJol=dR0\ckLKG`WeZ<[7LZNRf``BQc][GP@oM2Z^cWRFGAk9E7TZb7l_gj
X-Complaints-To abuse@zen.co.uk
Xref csiph.com comp.lang.python:45052

Show key headers only | View raw


On Wed, 08 May 2013 04:19:07 -0700, jamadagni wrote:

> I have the below C program spiro.c (obviously a simplified testcase)
> which I compile to a sharedlib using clang -fPIC -shared -o libspiro.so
> spiro.c, sudo cp to /usr/lib and am trying to call from a Python script
> spiro.py using ctypes. However it would seem that the first call to the
> callback results in a segfault.

> # call the C function
> spiro_to_bezier_strict ( src, len ( src ), bc )

This line should be:

  spiro_to_bezier_strict ( src, len ( src ), byref(bc) )

Without the byref(...), it will try to pass a copy of the structure rather
than passing a pointer to it.

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


Thread

Help with implementing callback functions using ctypes jamadagni <samjnaa@gmail.com> - 2013-05-08 04:19 -0700
  Re: Help with implementing callback functions using ctypes dieter <dieter@handshake.de> - 2013-05-09 07:54 +0200
  Re: Help with implementing callback functions using ctypes Stefan Behnel <stefan_ml@behnel.de> - 2013-05-09 08:57 +0200
  Re: Help with implementing callback functions using ctypes Nobody <nobody@nowhere.com> - 2013-05-09 19:32 +0100
    Re: Help with implementing callback functions using ctypes jamadagni <samjnaa@gmail.com> - 2013-05-23 20:11 -0700
  Re: Help with implementing callback functions using ctypes Dan Stromberg <drsalists@gmail.com> - 2013-05-23 20:26 -0700
    Re: Help with implementing callback functions using ctypes Shriramana Sharma <samjnaa@gmail.com> - 2013-05-26 09:12 -0700
      RE: Help with implementing callback functions using ctypes Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-26 21:43 +0300
      Re: Help with implementing callback functions using ctypes Dan Stromberg <drsalists@gmail.com> - 2013-05-26 12:10 -0700

csiph-web