[Pyrex] Cannot cdef __init__?

Simon Burton simon at arrowtheory.com
Tue Jan 20 00:14:58 CET 2004


On Mon, 19 Jan 2004 09:14:10 -0800
Paul Prescod <paul at prescod.net> wrote:

> Simon Burton wrote:
> 
> > ...
> > 
> > Yes, I'd like this aswell.
> > As it stands, I use regular python classes and pass around CObjects in lieu of the real thing (a struct pointer).
> > It works OK, but involves a lot of PyCObject_FromVoidPtr/PyCObject_AsVoidPtr shenanigans.
> 
> Could you specifiy the precise problem that causes you all of this 
> PyCObject_ stuff? AFAIK, Andrew's only issue is with initialization 
> functions but I wonder if you are talking about being able to pass 
> around C types more generally.

Yes, it's mainly initialization. 

Some function (actually __init__) makes a struct in the process of doing its thing, but needs to
expose that struct (and associated functions) in a(nother) class.

I had zero success, after a couple of days, with c extension classes, so have abandoned them
in favour of the CObject/class approach. And yes, this seems entirely automatable (any
c pointer attribute is transparently wrapped inside a CObject).

Simon.

> 
> But your email does give me an idea: what if there was an easy way to 
> get Pyrex to automatically generate wrappers for struct types and 
> pointer types? Perhaps that would solve your problem?
> 
>   Paul Prescod
> 
> 
> 
> _______________________________________________
> Pyrex mailing list
> Pyrex at lists.copyleft.no
> http://lists.copyleft.no/mailman/listinfo/pyrex


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




More information about the Pyrex mailing list