[Pyrex] Newbie Missing a Fundamental Point?

Kent Borg kentborg at borg.org
Fri Jul 21 19:03:08 UTC 2006


Hi,

I just discovered Pyrex and it looks real cool.  But I am confused
about the ctypedef.  It seems that Pyrex wants to be told things
twice, once in a .h file and again in a Pyrex file.

Say I want to stuff some C struct to pass to a C routine.  It makes
sense that I have to tell Pyrex what .h file to look in to know what
the data structure is, but why do I need to also write a second
definition in Pyrex?  At first I didn't begrudge it too much, but
there were funny types in my struct, so I needed to define them too.
And they refer to further data types...and I feel like I am going to
suck in every .h file on my machine.

A little on what I am doing: I have a legacy product that is partly
written in C (low level realtime parts) and partly written in TCL
(driving the C and doing UI).  They use shared memory to talk to each
other, and the interface is not small, they basically expose their
innards to each other.  I have to extend the system and don't want to
do it in TCL, I would like to use Python.  I figured my Pyrex code
would see the gory C innards, but it would present a cleaner interface
up to Python.  Pyrex looked great, but I feel like I am copying,
pasting, and then editing every .h file in the system.

And what happens when one of those .h files changes?  How does one
practically keep Pyrex in synch?  


What am I doing wrong?  (Using the wrong tool...?)


Thanks,

-kb



More information about the Pyrex mailing list