[Pyrex] Wrapping a large number of #defines
Simon Burton
simon at arrowtheory.com
Fri Dec 10 00:31:06 CET 2004
I wrote an h2py script some time ago that uses gcc's -dM option to
output all the defines it finds and then
rewrite those into a python script:
http://arrowtheory.com/software/python/h2py-0.1.1.tar.gz
ciao,
Simon.
Wes Kurdziolek wrote:
> For a project at work, I'm splitting up several old C programs into
> functions, some of which end up wrapped in Python via Pyrex. However,
> some of our Python needs access to quite a few constants defined via
> #define in a C header file, and I was wondering if anyone had an easy
> way of wrapping them. Our current proposed solution is to create a
> seperate pyx file (_constants.pyx, say) w/ a cdef enum block listing
> all the constants and beneath that assign the wrapped values to
> module-level variables that can be accessed when the resulting
> _constants.so is imported. This works, but if there's an easier and
> less time-consuming way of doing it, I'd love to hear it. Thanks!
>
> Wes Kurdziolek
> wkurdziolek at devis.com
>
> _______________________________________________
> Pyrex mailing list
> Pyrex at lists.copyleft.no
> http://lists.copyleft.no/mailman/listinfo/pyrex
>
More information about the Pyrex
mailing list