The ctypes module overview :: "tutorial":tutorial.html :: "reference":reference.html :: "faq":faq.html ( Work in progress: "COM":com.html :: "COM sample":sum_sample.html ) Overview 'ctypes' is a Python package to create and manipulate C data types in Python, and to call functions in dynamic link libraries/shared dlls. It allows wrapping these libraries in pure Python. It works on Windows, Linux and MacOS X and other systems. The latter require that your machine is supported by libffi. News **'ctypes' version 0.9.1 has been released (Sept 14, 2004).** ctypes can now call Python API functions (without releasing the global interpreter lock). Slicing is now supported for array and pointer instances. Several bugfixes. Detailed changelogs are in CVS (well, sometimes I forget to update them): "ANNOUNCE":http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/ANNOUNCE?rev=release_0_9_1 "ChangeLog":http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/ChangeLog?rev=HEAD "com ChangeLog":http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/win32/com/ChangeLog?rev=HEAD Future plans The ultimate purpose of the 0.9 release series is to shake out the remaining bugs, especially on platforms I have no access to, and to target a rock stable ctypes 1.0 release. When ctypes 1.0 is released, the com framework will be split off into a separate framework named 'comtypes'. Testimonials *I am using it and much prefer it to the calldll/windll ... easy to use, well documented ...* - Ben C *Your ctypes stuff is awesome! Thanks so much for making it. Almost every time I write a C extension it's so I can call some Windows function - I don't know if I'll need to do that much anymore and that makes me very happy. :)* - Dave Brueck *ctypes! With stuff like Pysco and Pyrex maturing, the main reason I was still writing C extensions was to access various Windows APIs (especially those not covered in the Win32 Python extensions), but no longer - I may never write another "wrapper" extension again and that makes me very, very happy. :)* - Dave Brueck *I like the idea of using ctypes for creating highly native windows applications. So far I have been using wxPython, but that library is so big that it adds 3-4 seconds latency to the startup of the python :-), Also memory footprint is kind of huge.* - Henk Punt *... and I just started using ctypes tonight. Good old calldll/windll won't be in my toolkit much longer. :) It's a very exciting time for Python. Between Psyco and ctypes, writing code in C is becoming quite rare for me!* - Jimmy Retzlaff *ctypes is very cool! Great piece of work.* - Just van Rossum Old news **'ctypes' 0.9.0:** 'ctypes' now requires Python 2.3 or higher, Python 2.2 is no longer supported. The big change is that 'ctypes' now uses the same code base on all platforms, many, many bug should have been fixed this way on non-windows systems. There have been lots of improvements and additions both to ctypes itself, and to the ctypes.com windows framework, too many to remember now and document here. Most prominent additions to ctypes.com are: A ctypes.com.client module supporting dynamic dispatch An internet explorer toolband sample Many improvements to the stoplite sample Documentation An extensive tutorial is included in the source distribution, but also available "online":tutorial.html. You should also read the sample files in the source distribution. Downloads Recent releases can be downloaded in the "sourceforge files section":http://sourceforge.net/project/showfiles.php?group_id=71702. The source archives contain all the sources, the documentation you are reading here, and sample files in a 'samples' subdirectory. Looking at the sample files is highly recommended in addition to reading the documentation. The binary Windows distribution only everything except the documentation, the unittests, and some example scripts. These files are distributed under the "MIT license":LICENSE.txt.