[Pyrex] python callback appended to external C struct

Lenard Lindstrom len-l at telus.net
Mon Dec 5 04:19:18 CET 2005


On 4 Dec 2005 at 23:10, Elias Pschernig wrote:

> 
> That's a great idea. Actually, I do not even need the "self" anymore at
> all then.. and also not the CWrapPositionPyrex struct. I simply map the
> pointer of the C struct to my python object.
> 
> I tried it out below.. but one think I'm wondering, is the <int> the
> right way to do it? Without it, pyrex would complain. I simply need to
> somehow use the C struct as dictionary key..
> 

Just to answer your question, the structure's address uniquely 
identifies the object instance, its contents would only identify a C 
function shared by all the instances. The <int> cast of course tells 
Pyrex to treat the void pointer as a C int, something Pyrex knows how 
to convert to a Python object.

Lenard Lindstrom
<len-l at telus.net>




More information about the Pyrex mailing list