[Cython] wrapping c++
Stefan Behnel
stefan_ml at behnel.de
Tue Mar 4 18:07:55 CET 2008
Neal Becker wrote:
> Stefan Behnel wrote:
>
>> William Stein wrote:
>>> cdef extern from "":
>>> void DEFINE_SET "#define SET(a,b,c) a[b]=c; //"()
>>> void SET(intvec, int, int)
>>> DEFINE_SET()
>>>
>>> The key thing is the evil dirty trick to define a SET macro directly in
>>> Cython.
>>
>> "Evil" and "dirty" were exactly the two words that came to my mind
>> before I even got to reading your own comment on this. :)
>>
>> I would really put something like this into an external header file, and
>> just declare "SET()" as being external...
>>
> Any thoughts on what it would take to support a non-evil implementation?
The above is ok, except that I wouldn't write something like this into a
Cython file. You will likely need a header file for a couple of low-level
things anyway, so I would just create one with the "#define" above and
keep the 'cdef extern from "theheader.h"' for the "SET()" function (read:
macro).
Stefan
More information about the Cython-dev
mailing list