Creating custom Python objects from C code
Eric Frederich
eric.frederich at gmail.com
Wed Jan 5 11:27:02 EST 2011
I have read through all the documentation here:
http://docs.python.org/extending/newtypes.html
I have not seen any documentation anywhere else explaining how to
create custom defined objects from C.
I have this need to create custom objects from C and pass them as
arguments to a function call.
Question 1: how am I to create those objects from C code?
The other thing I would like to know is how I can create helper
functions in my extension so they can be created and manipulated
easily.
I am thinking along the lines of the built-in helper functions
PyList_New and PyList_Append.
Once I have an answer to question 1, the problem won't be creating the
helper functions, but making them available from something built with
distutils.
To use the builtin python functions from C I need to link against
python27.lib but when I create my own package using distutils it
creates dll or pyd files.
Question 2: How do I make C helper functions that are part of my
extension available to other C projects in the same way that PyList_*,
PyString_*, PyInt_* functions are available?
Is it possible to have distutils make a .lib file for me?
Thanks,
~Eric
More information about the Python-list
mailing list