(from stdlib-sig) ctypes or struct from an h file

Diez B. Roggisch deets at nospam.web.de
Sun Oct 18 22:13:10 CEST 2009

Yuvgoog Greenle schrieb:
> Is there a way that Python and C can have a shared definition for a
> binary data structure?
> It could be nice if:
> 1. struct or ctypes had a function that could parse a .h/.c/.cpp file
> to auto-generate constructors
> or
> 2. a ctypes definition could be exported to a .h file.
> So my question is - is there a way to do this in the std-lib or even pypi?
> --yuv
> ps If this doesn't exist, then I'm probably going to open a project
> and would like some tips/ideas.

gccxml can be used to do this, there is a ctypes utilities module that 
works with the output of gccxml.


More information about the Python-list mailing list