[Python-3000] threading, part 2 --- + a bit of ctypes FFI worry (original) (raw)
Lawrence Oluyede l.oluyede at gmail.com
Sat Aug 12 13:11:47 CEST 2006
- Previous message: [Python-3000] threading, part 2 --- + a bit of ctypes FFI worry
- Next message: [Python-3000] threading, part 2 --- + a bit of ctypes FFI worry
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 8/12/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
Tim Peters wrote:
> It's unclear to me how to write portable ctypes code in the presence > of a gazillion integer typedefs and #defines, such as for Pyssizet. A start would be to have constants in the ctypes module for Pyssizet and other such Python-defined API types.
rctypes and pypy tools are somewhat one step further than ctypes machinery. In rctypes you can easily do something like:
size_t = ctypes_platform.SimpleType("size_t", c_ulong)
In this way you have platform safe data type to use in your code. The second argument of SimpleType() is a hint for the tool.
You can also use ConstantInteger() and DefinedCostantInteger() to get values of costants in headers file like this:
BUFSIZ = ctypes_platform.ConstantInteger("BUFSIZ")
Maybe one day this can be ported to CPython ctypes from the RPython one.
-- Lawrence http://www.oluyede.org/blog
- Previous message: [Python-3000] threading, part 2 --- + a bit of ctypes FFI worry
- Next message: [Python-3000] threading, part 2 --- + a bit of ctypes FFI worry
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]