Skip to content

Instantly share code, notes, and snippets.

@niallo
Created May 14, 2011 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niallo/972629 to your computer and use it in GitHub Desktop.
Save niallo/972629 to your computer and use it in GitHub Desktop.
ctypes circular definition work around
from ctypes import *
class NANNY_TIMER(Structure):
_fields_ = [("when", c_long),
("data", c_void_p),
("f", POINTER(NANNY_TIMER_CB))
]
# XXX is there a way around this hack for circular definition?
class NANNY_TIMED_T(Structure):
pass
class NANNY_TIMED_T(Structure):
_fields_ = [("next", POINTER(NANNY_TIMED_T)),
("timer", POINTER(NANNY_TIMER)),
("interval", c_long),
("last", c_long),
("cmd", c_char_p),
("envplen", c_int),
("envp", POINTER(c_char_p))
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment