[Ann] ctypes 0.4.0 released

Thomas Heller theller at python.net
Fri Feb 7 22:17:04 CET 2003


I've just released ctypes 0.4.0.

Homepage http://starship.python.net/crew/theller/ctypes.html

-----

ctypes is a module allowing to create and manipulate C data types in
Python. These can then be passed to C-functions loaded from dynamic
link libraries.

This module is supposed to be a greatly enhanced and much more
complete replacement of Sam Rushing's calldll/npstruct/windll
modules. ctypes is not based on Sam's work, it has different roots.

It requires Python 2.2 or higher, since it makes intensive use of the
new type system.

ctypes runs on Windows, Linux, and MacOS X (and maybe on other systems
as well).

For all platforms except Windows you'll need a recent version of
libffi which supports your processor.  Ronald Oussoren has kindly
assembled a snapshot of libffi taken from the GCC CVS repository which
works with this release, it is available for download from the ctypes
download page
http://sourceforge.net/project/showfiles.php?group_id=71702.

----
Version 0.4.0, 2003-02-07:

    This an intermediate release, there is still a lot to be done.

    Changes:

        ctypes works with Python 2.2 and Python 2.3 now.

	Structure and Union fields have now readonly .size and .offset
	properties, see the docs.

	POINTER instances can now be indexed as if they point to arrays
	of objects instead of only a single object.

	CFunction instances now have a .from_param class method.
	(This is the protocol which allows to validate and convert
	function call arguments from Python to C - in other words, you
	can now use a CFunction subclass in the argtype attribute for
	a function from a DLL to specify the type of the callback
	function.  Does anyone understand this?)

	Argument conversion from Python to C is somewhat faster now.

	I added a lot of unittests, which not only check for bugs,
	but also 'describe the current behaviour'.  Unittest rocks!
	
    Lots and lots of bugs and potential crashes have been fixed:

	Alignment and sizes of structures and unions is now correct as
	far as I can see.

	Assigning Python numbers to mutable integer types (c_short,
	c_int, c_long and so on) now correctly checks for valid range,
	you can no longer assign a negative Python number to an unsigned
	C data type for example.

    General News:

	I moved the sources from local CVS to SourceForge CVS
	repository.

-- 

Thomas





More information about the Python-list mailing list