The ctypes package ================== Overview -------- ``ctypes`` is an advanced ffi (Foreign Function Interface) package for Python_ 2.3 and higher. In Python_ 2.5 it is already included. ctypes allows to call functions in dlls/shared libraries and has extensive facilities to create, access and manipulate simple and complicated C data types in Python - in other words: wrap libraries in pure Python. It is even possible to implement C callback 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 that libffi supports this platform. ``ctypes`` is licensed under the `MIT License`_. .. _Python: http://www.python.org/ .. _`MIT License`: http://svn.python.org/view/*checkout*/ctypes/trunk/ctypes/LICENSE.txt Documentation ------------- Documentation is available in several formats. - The tutorial_ and the reference_ as one single HTML page each. - Single HTML pages from the official `Python 2.5 documentation`_. The ctypes-users `mailing-list`_ is the place to ask questions about ``ctypes`` and related packages; to reduce spam it is now required to be subscribed before posting. This mailing list is also available on `gmane`_ in several ways. The `ctypes-wiki`_ will hopefully soon contain additional documentation, code snippets, answers to FAQs and more. .. _tutorial: ./tutorial.html .. _reference: ./reference.html .. _`mailing-list`: https://lists.sourceforge.net/lists/listinfo/ctypes-users .. _gmane: http://gmane.org/info.php?group=gmane.comp.python.ctypes .. _`Python 2.5 documentation`: http://docs.python.org/dev/lib/module-ctypes.html .. _`ctypes-wiki`: http://starship.python.net/crew/theller/wiki Related projects ---------------- A codegenerator (`old documentation`_, out of date but you may get the idea) which will parse C header files and generate ctypes compatible Python code. There is currently no official release for the code generator, but you can get it from the `ctypeslib SVN repository`_. A pure Python COM package named comtypes_, especially useful for calling and implementing custom COM interfaces without the need to write C/C++ code. The `comtypes SVN repository`_ contains a much improved version, I will release this asap. .. _`ctypeslib SVN repository`: http://svn.python.org/projects/ctypes/trunk/ctypeslib/ .. _`comtypes SVN repository`: http://svn.python.org/projects/ctypes/trunk/comtypes/ .. _comtypes: http://cheeseshop.python.org/pypi/comtypes .. _`old documentation`: http://starship.python.net/crew/theller/ctypes/old/codegen.html Downloads --------- Recent releases can be downloaded in the `sourceforge files section`_. The current version is 1.0.1. ``ctypes`` is registered in the `Python package index`_, so you can also install it with easy_install. .. _`Python package index`: http://www.python.org/pypi/ctypes .. _`sourceforge files section`: http://sourceforge.net/project/showfiles.php?group_id=71702