ctypes 0.9.2 released

Thomas Heller theller at python.net
Thu Oct 28 20:38:57 CEST 2004

ctypes 0.9.2 released - Oct 28, 2004


    ctypes is a ffi (Foreign Function Interface) package for Python
    2.3 and higher.

    ctypes allows to call functions exposed from 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 runs on Windows, MacOS X, Linux, Solaris, FreeBSD, OpenBSD.
    It may also run on other systems, provided that libffi supports
    this platform.

    On windows, ctypes contains a ctypes.com package which allows to
    call and implement custom COM interfaces.


    If you download the source distribution, please choose the ZIP
    file for Windows, and the .tar.gz file for other systems.
    These archive have different contents!

Changes in 0.9.2

    Fixed several bugs and memory leaks.

    ctypes is now tested on Windows, Linux (x86 and x86_64), OpenBSD
    and Mac OS X.

    Implemented some helper functions: memmove, memset, string_at, wstring_at.
    The former act as their C library counterpart, the latter two allow
    to read a zero-terminated (wide) strings at a certain address.

    Implemented a cast(cobj, ctype) function, which creates a new object
    of the specified ctype from an existing object.

    ctypes now explicitely allocates executable memory for the callbacks
    it creates, this makes it work correctly on platforms where
    executing data is normally forbidden (OpenBSD, Win XP SP2 on AMD 64).

    Fixed the unicode handling on non-windows platforms.

    Bit fields in structures and unions are now implemented.
    For a bit field, one would specify the width in bits as the third
    part in the _fields_ list like this:

	class BitFieldSample(Structure):
	    _fields_ = [("anInt", c_int),
			("aBitField", c_int, 3)]

    POINTER(None) now returns c_void_p.  This change was made for easier
    code generation, and makes sense since 'None' is the ctypes way to
    spell 'void'.

    Detailed changelogs are in CVS:


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'.


    Downloads are available in the sourceforge files section

    Separate source distributions are available for windows and non-windows systems.
    Please use the .zip file for Windows (it contains the ctypes.com framework),
    and use the .tar.gz file for non-Windows systems (it contains the
    complete cross-platform libffi sources).

    Binary windows installers, which contain compiled extension
    modules, are also available, be sure to download the correct one
    for the Python version you are using.





More information about the Python-announce-list mailing list