
ctypes is an advanced ffi (Foreign Function Interface) packageforPython 2.3 and higher. InPython 2.5 it is alreadyincluded.
ctypes allows to call functions in dlls/shared libraries and hasextensive facilities to create, access and manipulate simple andcomplicated C data types in Python - in other words: wraplibraries in pure Python. It is even possible to implement Ccallback functions in pure Python.
ctypes works on Windows, Windows CE, Mac OS X, Linux, Solaris,FreeBSD, OpenBSD. It may also run on other systems, provided thatlibffi supports this platform.
ctypes is licensed under theMIT License.
Documentation is available in several formats.
- Thetutorial and thereference as one single HTML page each.
- HTML pages from the officialPython 2.5 documentation.
The ctypes-usersmailing-list is the place to ask questionsaboutctypes and related packages; to reduce spam it is nowrequired to be subscribed before posting. This mailing list isalso available ongmane in several ways.
Thectypes-wiki will hopefully soon contain additionaldocumentation, code snippets, answers to FAQs and more.
A codegenerator (old documentation, out of date but you may getthe idea) which will parse C header files and generate ctypescompatible Python code. There is currently no official releasefor the code generator, but you can get it from thectypeslib SVNrepository.
A pure Python COM package namedcomtypes, especially useful forcalling and implementing custom COM interfaces without the need towrite C/C++ code. Thecomtypes SVN repository contains a muchimproved version, I will release this asap.
Recent releases can be downloaded in thesourceforge filessection. The current version is 1.0.1.
ctypes is registered in thePython package index, so youcan also install it with easy_install.