On Jan 4, 2009, at 1:20 PM, Tony Houghton wrote:
I want to write python wrappers for the Linux DVB API. The underlying
structures and constants may change from time to time, and some of the
constants are generated from macros, so I think it would be better to
write the module in C rather than just copying the constants into pure
python code and using python's ioctl and struct modules.
The trouble is I can't find out how to define a simple python int
variable/constant in a C extension.
This works for me:
PyModule_AddIntConstant(module, "O_CREAT", O_CREAT);
I've had to learn a lot about writing extensions from looking at the
Python source code. Lots of valuable tricks to be learned there.
HTH
Philip
--
http://mail.python.org/mailman/listinfo/python-list