Hi,
David Cournapeau wrote:
> I would like to know whether adding an IFDEF-like feature in cython
> would be feasible ? I would like to define some cython code depending
> on some defines in the header of the library I am wrapping.
You can use a separate .h file and do something like this
#ifdef SOME_EXTERNAL_DEFINE
# define MYVAL 1
#else
# define MYVAL 0
#endif
then you can write this:
cdef extern from "myheader.h":
cdef int SOMETHING
if SOMETHING:
print "ON"
else:
print OFF
and the C compiler will do the right thing.
I wouldn't mind making this a general Cython feature, though. Maybe
something like
if cython.defined(SOME_NAME):
...
would work.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev