[Pyrex] C Globals

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Aug 16 01:24:01 UTC 2006


Kent Borg wrote:
> How do I share a global C variable between two Pyrex functions?

By declaring it as a C variable at the module level,
and using a global declaration inside each function
which wants to assign to it.

   cdef int my_int

   def my_func():
     global my_int
     my_int = 42

   def my_other_func():
     some_useful_func(my_int)

--
Greg



More information about the Pyrex mailing list