[Pyrex] pyrexembed: How to make a method which returns a struct

Simon Burton simon at arrowtheory.com
Tue May 23 02:41:42 CEST 2006


On Tue, 23 May 2006 12:37:24 +1200
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Martin Dobiasch wrote:
> >>Use "cdef RoomConnections getRoomConnections(..."
> >>
> >>Or look through the mail archives of this list to find other ways of doing the
> >>thing you might be trying to do here.
> > 
> > If I use cdef the function is not in the class.
> 
> Yes, it is, but you won't be able to call it from
> Python code.
> 
> If the method must be callable from Python, you will
> need to wrap the structure in a Python object somehow,
> such as using another extension type.
> 

For a quick (and dirty?) solution I often cast these pointers
to "long" and use them in python as ints.

:)

Simon.

-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 



More information about the Pyrex mailing list