[Pythonmac-SIG] Example of Building a C extension to Python?

Louis M. Pecora pecora@anvil.nrl.navy.mil
Mon, 10 Apr 2000 09:53:51 -0400


Does anyone have an complete example of a C file with a C function that gets turned into a Python module callable from a Python function? Hopefully, Macintosh based.

I have read much of the Extension doc and done some web searching, but I cannot seem to find a full, beginning-to-end example of taking a C function and making it into a Python module.  Nothing like really seeing how it's done.  The docs and web info show bits and pieces and talk about the need to do certain things, but leave it to the reader to put it all together.  I would like to see what has to be added to the C file to make it compatible with Python.  How the C file has to be compiled/linked (turned into a library?).  What other libraries or modules from the Python side are necessary to include with the C module (e.g. in a Codewarrior project for making the Python C module).  Probably a dozen other newbie questions.  Any help or pointers greatly appreciated.



Cheers,

Lou Pecora