[OT] pass a C callback function to a cythom module via python

Chris Colbert sccolbert at gmail.com
Sat Mar 17 15:44:43 EDT 2012


You can see how we did this before with the opencv wrappers starting at
line 117 of this file:

https://github.com/scikits-image/scikits-image/blob/0.3.1/scikits/image/opencv/opencv_cv.pyx


On Sat, Mar 17, 2012 at 2:35 PM, Chris Colbert <sccolbert at gmail.com> wrote:

> cytpes.addressof(...)
> On Mar 17, 2012 12:52 AM, "Nadav Horesh" <nadavh.horesh at gmail.com> wrote:
>
>> It is good to know that there is still a hope.  In my case I could make
>> it if only a ctype object would expose the address of the underlying C
>> object.
>>
>>  Thank you,
>>
>>      Nadav.
>>
>> בתאריך 16 במרץ 2012 18:09, מאת Stéfan van der Walt <stefan at sun.ac.za>:
>>
>>> Hi Nadav
>>>
>>> On Mar 15, 2012 10:54 PM, "Nadav Horesh" <nadavh.horesh at gmail.com>
>>> wrote:
>>> >
>>> > I have the following:
>>> > A library of C function which is compiled into a dll
>>> > A cython module with a function that expects as a parameter a C
>>> callback function.
>>> >
>>> > My problem is how to make a python script to pass directly the address
>>> of a C function from the dll to the cython function.
>>>
>>> There's a Cython Enhancement Proposal for this, but it hasn't been
>>> implemented:
>>>
>>> http://wiki.cython.org/enhancements/nativecall
>>>
>>> So, I don't think there's a cleaner way, unfortunately. It's great that
>>> you found a workaround, though--many people have been struggling with this
>>> issue.
>>>
>>> Stéfan
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20120317/64db9f0e/attachment.html>


More information about the scikit-image mailing list