5.1.2.4 Ctypes

Ctypes is included standard in Python 2.5, so it is clearly useful to many Python users. It allows one to call library functions defined in shared object libraries directory from interpreted Python code. For the core of Sage we have not found a use for this yet. First, when implementing a basic type that needs to be very fast, e.g., GMP integers, the entire implementation absolutely must be compiled - writing it as a combination of Python and C library calls will be way too slow. Second, it is often very painful to convert Python data structures to C data structures and conversely, and there are many opportunities for memory leaks and core dumps.

See About this document... for information on suggesting changes.