[Pyrex] struct containing pointer to function
Andreas Kostyrka
andreas at mtg.co.at
Thu Oct 9 16:00:02 CEST 2003
On Thu, Oct 09, 2003 at 06:30:51AM -0700, Bryan Weingarten wrote:
> sorry, but i'm reposting this question since it never got answered.
>
Ok, thought somebody else will answer ;)
cdef char *test1(int x):
return "TEST1"
cdef char *test2(int x):
return "TEST2"
cdef struct TEST:
int x
char *(*test)(int)
cdef TEST x
x.test = &test1
print x.test(0)
x.test = &test2
print x.test(0)
Basically use it as you would do it in C :)
Andreas
More information about the Pyrex
mailing list