ctypes 0.9.6 released - Mar 18, 2005
====================================
Overview
ctypes is an advanced 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 now includes a code generator toolchain which allows
automatic creation of library wrappers from C header files.
This feature is still experimental and beta quality.
ctypes runs on Windows, MacOS X, Linux, Solaris, FreeBSD, OpenBSD.
It may also run on other systems, provided that libffi supports
this platform.
For windows, ctypes contains a ctypes.com package which allows to
call and implement custom COM interfaces.
Important
If you download the source distribution, please choose the ZIP
file for Windows, and the .tar.gz file for other machines.
These archive have different contents!
There have been lots of changes - if you are the author or user of
a package that uses ctypes, please test it with this release
and report problems on the ctypes-users mailing list.
Changes in 0.9.6
Thanks to all of you who reported bugs so quickly, and those who
tried out the codegenerator toolchain.
Bug fixes:
- keyword arguments in Structure/Union initializers had no effect.
- it was impossible to override the from_parm class method
in subclasses of c_void_p, c_char_p, and c_wchar_p.
- removed the __del__ method of _CDLL. It caused uncollectable
garbage in Python's gc.
- ctypes.com.register: enclose the Python script to run a com
server in quotes, otherwise it won't run correctly when the
directory name contains spaces.
Enhancements:
- Several changes have been made to the h2xml script from the
codegenerator toolchain. See the documentation (linked below) for
details.
-----------------------
Additions in 0.9.5
New package ctypes.wrap. This contains decorators usable for
easier creation of wrapper functions.
This package also contains a toolchain for (semi)automatic
creation of wrappers for external libraries - it can parse
C header files and generate ctypes code for the declarations in
them. It can even handle preprocessor definitions! For details,
see http://starship.python.net/crew/theller/ctypes/codegen.html
Changes in 0.9.5
On systems where sizeof(int) == sizeof(long), c_int/c_long and
c_uint/c_ulong are now aliases. Similar for c_long/c_longlong and
c_ulong/c_ulonglong. This prevents unneeded type errors.
If an exception occurs in a callback function, a full traceback is
now printed. Raising SystemExit in a callback function now
correctly exists Python.
HRESULT is now a proper ctype - no longer a function. This allows
to use it in the argtypes sequence for function prototypes.
An easier way to define structures and unions that reference
themselves, or have dependencies to other data types. The
_fields_ attribute can now be set *after* the Structure/Union
class has been created. This makes the SetPointerType function
obsolete.
The semantics of the _fields_ attribute in sub-subclasses of
Structure and Union has been fixed. The baseclasses _fields_ list
is extended, not replaced, in subclasses. Assigning _fields_ when
it is no longer possible raises an error now.
Structures and unions now work as restype and in the argtypes list
for functions.
An important bug has been fixed with pointers.
Detailed changelogs are in CVS:
<http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/ChangeLog?rev=HEAD>
<http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/win32/com/ChangeLog?rev=HEAD>
Download
Downloads are available in the sourceforge files section
<http://sourceforge.net/project/showfiles.php?group_id=71702>
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.
Homepage
<http://starship.python.net/crew/theller/ctypes/>
Enjoy,
Thomas