ctypes 0.9.5 released
theller at python.net
Fri Mar 11 22:04:01 CET 2005
ctypes 0.9.5 released - Mar 11, 2005
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 runs on Windows, MacOS X, Linux, Solaris, FreeBSD, OpenBSD.
It may also run on other systems, provided that libffi supports
For 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 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.
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,
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
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
An important bug has been fixed with pointers.
Detailed changelogs are in CVS:
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