[pypy-dev] RPython function callback from C
Amaury Forgeot d'Arc
amauryfa at gmail.com
Sun Aug 15 21:32:51 CEST 2010
Hi,
Le 14 août 2010 03:51:00 UTC+2, Hart's Antler <bhartsho at yahoo.com> a écrit :
> I have the PortAudio blocking API working, simple reading and writing to the
> sound card works. PortAudio also has an async API where samples are fed to
> a callback as they stream in. But i'm not sure how to define a RPython
> function that will be called as a callback from C, is this even possible? I
> see some references in the source of rffi that seems to suggest it is
> possible.
Yes this is possible.
See an example in pypy/rpython/lltypesystem/test/test_ll2ctypes.py
in the function test_qsort_callback().
Why are you passing _callable=stream_callback?
It should be enough to pass stream_callback directly as a function argument.
--
Amaury Forgeot d'Arc
More information about the Pypy-dev
mailing list