Any c header parser for generate ctypes module?

Nick Craig-Wood nick at
Mon Mar 9 16:30:04 CET 2009

Diez B. Roggisch <deets at> wrote:
>  Victor Lin wrote:
> > I am writing python binding for some c library. It is really a super
> > boring job. Copy... paste... modify.. copy paste...modify.... I am
> > wondering, I am a programmer, why I can't do this job like a
> > programmer? So I think the best way to write binding for those c
> > libraries, is to write a parser that parse header of c library and
> > generate ctypes python module automatically. My question is, is there
> > any available tools can achieve this? If not, what tool can I use to
> > such a job easily. I need a c parser, is there any C parser written in
> > python?
>  GCCXML is usually used to create ctypes-structures from headers.

Look at

And the h2xml and xml2py scripts that are part of it.

You'll need gccxml too as Diez pointed out.

A definite time saver!

Nick Craig-Wood <nick at> --

More information about the Python-list mailing list