On Monday 08 February 2010 18:04:18 Dag Sverre Seljebotn wrote: > Stefan Behnel wrote: > > Hi, > > > > I'm trying to implement the PyBindGen micro-benchmarks in cython-devel by > > wrapping this source file: > > > > http://bazaar.launchpad.net/~gjc/pybindgen/trunk/annotate/735/benchmarks/ > >testapi.cc > > http://bazaar.launchpad.net/~gjc/pybindgen/trunk/annotate/735/benchmarks/ > >testapi.h > > Woah, I never knew about that project. > > Could we borrow the .h parser strategy (whatever that is) for Cython?
IIRC, pybindgen relies on gccxml[0] for the automatic .h parsing. gccxml, which is barely maintained, hacks the gcc compiler to get its internal representation of a compilation unit to spit it out as a fat xml file that one can post-process to do all kind of things. this is how the reflex[1] (CERN-based) project automatically generates bindings and runtime reflection/introspection to/for C++ classes. the only problem is that gccxml is actually based on the C++ parser, so if the header you feed it with is only C-compliant then you are screwed... there are alternatives: - the mozilla guys developed a gcc plugin[2] (for gcc-4.5 or a patched gcc-4.4) to do the same kind of thing (but their main goal is to perform C++ code refactorization) - clang/llvm, when the C++ support will be improved cheers, sebastien. [0] http://www.gccxml.org/HTML/Index.html [1] http://root.cern.ch/drupal/content/reflex [2] https://developer.mozilla.org/en/Dehydra > > Dag Sverre > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > -- ######################################### # Dr. Sebastien Binet # Laboratoire de l'Accelerateur Lineaire # Universite Paris-Sud XI # Batiment 200 # 91898 Orsay ######################################### _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
