gcc-xml

slanning on 2007-09-19T12:30:46

For my current library-wrapping project, I want to automate more of the bindings generation. It's a C++ library, so I'm parsing C++ headers. At first I did that kind of manually, which wasn't pleasant. Then someone pointed me to gcc-xml, which does indeed parse the C++ headers and outputs an XML file. A 25MB XML file, in fact, for the particular headers I used it on. The XML file is fairly easy to figure out, though following (dereferencing) all the ID numbers pointing to other elements is tedious.

So, two purposes: 1) Let people who've never heard of gcc-xml know about it. 2) Ask if there is anything else people use to (help) parse C++ headers.

Third purpose: ultimately I'll only have a sloppy, one-off XSUB generator for my specific needs. I'm suggesting, then, that someone, like a university student with too much time and more l33t C++ and XS skillz than me, might find it an interesting project to look into generalizing this to automate generation of Perl bindings for any C++ library.


Use Perl to parse C++ headers!

Ron Savage on 2007-09-20T00:21:58

You want perceps.pl. Email me:
ron at savage.net.au if you can't find a copy by Googling.