2 Aug 2011 11:18
Re: cython and preprocessor
Dag Sverre Seljebotn <d.s.seljebotn <at> astro.uio.no>
2011-08-02 09:18:42 GMT
2011-08-02 09:18:42 GMT
On 08/02/2011 11:15 AM, Dag Sverre Seljebotn wrote: > On 08/02/2011 09:49 AM, Denis Bilenko wrote: >> Hi, >> >> I've been using Cython for gevent (http://gevent.org) for 2 years now >> and love it. Thanks to all the authors and the contributors! >> >> One problem that I have to work around is lack of preprocessor support. >> >> I've been using this hack: >> >> cdef void emit_ifdef "#if defined(_WIN32) //" () >> cdef void emit_else "#else //" () >> cdef void emit_endif "#endif //" () >> >> but that's very very limited, as it only can be used in the executable >> code and not in declarations (also results in compiler warnings). >> >> So I've made another hack: https://github.com/denik/cython-ifdef >> >> It uses unifdef to process the source multiple times for all possible >> configurations of symbols definitions and then runs cython on all >> those sources and then merges the resulting .c files into one. > > Nice trick! > > IMO it would be nice to have this integrated into Cython itself at some > point, building on Cython syntax, e.g.: > > cdef class A:(Continue reading)
RSS Feed