[Pyrex] Re: Pyrex pointer problem

Mike Rovner mike at bindkey.com
Thu Apr 24 22:30:37 CEST 2003


"Edward C. Jones" <edcjones at erols.com> wrote in message
news:3EA7E11A.7050208 at erols.com...
> Mike Rovner <mike at bindkey.com> said
>
>  > You are operating on single-linked list at C level. Since Python has a
>  > notion of list you better consider returning C list as a whole as
>  > Python list or tuple of iVals.
>
> I am interested in wrapping things of the form
>
> typedef struct _A {
>      ...
> } A;
>
> typedef struct _B {
>      ...
>      struct A*;
>      ...
> } B;
>
> This includes the self-referential example I gave.

Python doesn't have a notion of pointers, so trying to manipulate them
you're heading to trouble IMHO.
Thus no framework will be good help for you. ;) you have to struggle with
ref counting yourself.

boost.python can create a special Python proxy object for a you,
representing a pointer but helping with
ref counting (it's require a decent C++ compiler though)

Probably if you present some wider context it can be possible to leverage
Python representation of your problem
to the level of objects Python is good to operate.

Regards,
Mike







More information about the Pyrex mailing list