[Pyrex] Re: newby guidance
Mike Rovner
mike at nospam.com
Wed Jun 25 20:29:24 CEST 2003
Robin Becker wrote:
> I want to utilize a large C struct in both pyrex and C. I already
> have a defining header file so the C code just imports the header.
Elaborate your meaning of utilization, please.
> Can I make use of pyrex to create my struct and pass it around to C
> code without defining the struct again in pyrex?
No, unless you don't need to access it memebers from pyrex.
i.e. if you use only part of it or pointer to it, etc., you can cheat and
use 'different ' declaration in pyrex, but it's tricky and you have to know
what you are doing,
otherwise you get hard to repair bugs.
> I'm a bit confused about how this all works. I had imagined naively
> that one could somehow just wrap the struct using the header file and
> add methods in pyrex.
In a way. You have to explain to pyrex, what that structure is in order to
get inside it.
Pyrex doesn't parse .h files, it parses its own. So either you or some
script translate from .h to .pyx
0.8 addition allows you to translate to .pxd and add methods in .pyx
Hope that helps,
Mike
More information about the Pyrex
mailing list