Link between a C variable and a python object

Robert Roy rjroy at takingcontrol.com
Tue Oct 16 09:39:38 EDT 2001


On Fri, 12 Oct 2001 13:01:23 +0200 (CEST), Mads Bondo Dydensborg
<madsdyd at challenge.dk> wrote:

>On 12 Oct 2001, Armin wrote:
>
>> In article <3BC4366A.DC3F6982 at wanadoo.fr>, guignot says...
>> >
>> >Does Python have a nice feature of Tcl, i.e. linking an external C
>> >variable and an internal variable, with TclLinkVar ?
>> 
>> Yes ... have a look to the C API.
>
>Could you possible be more specific? I have looked at the API, and the
>code generated by SWIG, and it seems that you need to use function calls -
>there seems to be no easy way to share a variable?
>
>Mads


See the sources for fileobject.c. It exposes some C vars to python. 
look for "struct PyMemberDef" and follow the declared variable. Note
that python 2.2 has a new way of doing this. It seems simpler than
before now.

I have not tried this. Your question just got me looking thats all... 

bob

>
>-- 
>Mads Bondo Dydensborg.                               madsdyd at challenge.dk
>It is strange to claim that video games should influence children. If for
>example Pac-Man influenced children born in the 1980'ies, then today we
>would have a lot of young people jumping around in dark rooms, eating pills
>while listening to monotome music
>
>          - Anonym
>
>




More information about the Python-list mailing list