Pyrex: wrapping #defines with a type name argument
Greg Ewing (using news.cis.dfn.de)
ckea25d02 at sneakemail.com
Mon Apr 14 07:15:53 CEST 2003
Edward C. Jones wrote:
> A common type of C macro has a type as an argument. For example:
> #define GET_ELEM(type,x,n) (*(type*)((char*)(x) + n))
> What is a good way to wrap this in Pyrex (if any)?
I don't think there's any good way. The only things I can
think of offhand are:
(1) Write a bunch of external C functions, one for each
type you want to deal with, which call the macro,
and then wrap those.
(2) Don't use the macro at all, and do the casting
yourself in Pyrex each time you need it.
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
More information about the Python-list