py-ext: casting pointers to ints on 32bit and 64bit systems

Thomas Heller theller at python.net
Fri Jan 27 18:09:17 EST 2006


Alexander Schmolck <a.schmolck at gmail.com> writes:

> what's the best approach to write C(++)-extension code that has to
> create a python int from a C pointer and vice versa so that it works
> smoothly on 32 bit and 64 platforms (on which sizeof(int) !=
> sizeof(*void)) equally work (under unix,mac&windows and with gcc, vc
> and borland)?

PyLong_FromVoidPtr and PyLong_AsVoidPtr.

Thomas



More information about the Python-list mailing list