ctypes vs. swig

Nelson Minar nelson at monkey.org
Sat Oct 30 14:11:28 EDT 2004


ctypes looks very powerful, and the convenience of doing everything at
runtime seems significant. To what extent is it a replacement for swig
for calling C code? I haven't really used ctypes, so I'm asking.

Are there jobs that swig is better at and jobs that ctypes is better
at? ctypes requires your code be in a dynamic library, and that ctypes
is for C only. But those don't seem like major drawbacks for my uses.


I did a bit of research on this question and all I found was this:
  http://sourceforge.net/mailarchive/message.php?msg_id=6887157

  I have been thinking about instead of swig using ctypes and some
  form of automated header parser to make a new pyopengl



More information about the Python-list mailing list