[Pyrex] wrapping "Dynamic" cast

Toshio toshio at tiki-lounge.com
Fri Jan 16 17:47:59 CET 2004


Hi,
I'm wrapping a library that has a Macro that does "dynamic" casting. 
I've been trying to get this simplified version to work:

in C macro.h:
#define CAST (i, type) ((type *)i)

In Pyrex I get to this point and realize I have no idea what I'm doing
:-)

cdef extern from "macro.h":
    CAST(int i, char *type):
        return (<type*>(i))

This fails with:
/home/badger/programming/test/macro.pyx:3:21: Declarator should be empty
/home/badger/programming/test/macro.pyx:3:21: Expected '>'

Is this even possible?  It's really a CPP trick rather than a C one.
Thanks,
Toshio
-- 
Toshio <toshio at tiki-lounge.com>




More information about the Pyrex mailing list