Function References

Diez B. Roggisch deets at nospam.web.de
Thu Jul 31 10:06:44 EDT 2008


squishywaffle at gmail.com wrote:

> Hello Diez.
> 
>> May I suggest you move to ctypes for wrapping? It's easier, pure python
>> and callbacks are already built-in.
> 
> I'm pretty new to extending Python in C, I don't understand what
> you're saying. Are there any examples or a brief explanation/URL you
> could point me to?

Is google dead today?

http://www.google.com/search?q=python+ctypes&ie=UTF-8&oe=UTF-8

First hit.

Ctypes is a since python2.5 built-in module that allows to declare
interfaces to C-libraries in pure python. You declare datatypes and
function prototypes, load a DLL/SO and then happily work with it. No C, no
compiler, no refcounts, no nothing.

And you can pass python-functions as callbacks.

See the module docs for examples.

Diez



More information about the Python-list mailing list