(from stdlib-sig) ctypes or struct from an h file
Diez B. Roggisch
deets at nospam.web.de
Sun Oct 18 22:48:26 CEST 2009
geremy condra schrieb:
> On Sun, Oct 18, 2009 at 4:13 PM, Diez B. Roggisch <deets at nospam.web.de> wrote:
>> 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
>>> 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?
>>> 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.
> Found this: http://starship.python.net/crew/theller/ctypes/old/codegen.html
> which I take to be the module you're talking about. From the docs it doesn't
> appear to have worked with gccxml since before 0.6, which is more than 5
> years old. Am I at the wrong place?
Nope, that's it. I don't understand what you mean with "since before
0.6" - all I can say is I got it working last year with a GCC 3.X or 4.x
More information about the Python-list