I'm trying to interface with some C code that defines a type called
"object"
typedef union {
struct {
objtype type; reftype nref;
} any;
intcel i;
bigint b;
vector v;
matrix m;
poly pl;
simpgrp s;
group g;
tekst t;
} objcel, *object;
However, if I try to write some cython code involving an object:
cdef extern object groupmake(char lietype, int rank)
cdef object g
g = groupmake("A", 3)
It's interpreted as a PyObject in the c code:
PyObject *__pyx_t_1 = NULL;
...
__pyx_t_1 = groupmake('A', 2);
One possible solution is to just replace the word "object" in the C
source with something else throughout. But I'd like to make as few
modifications of the C source as possible. Is there an alternate
solution?
I actually have another unrelated question: what is the correct cython
syntax for the union statement at the top of this message? Cython
doesn't seem to like me putting
struct any:
objtype type
reftype nfref
in the middle of a union statement. And I'm also not sure what to do
with "objcel, *object" at the end there. I'm a novice at this stuff,
so apologies if these are stupid questions.
Thanks so much,
David
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev