The document at <http://docs.python.org/ext/building.html> should get you going.
To quote from that, create a setup.py containing: #BEGIN OF FILE from distutils.core import setup, Extension module1 = Extension('demo', sources = ['mandel.c']) setup (name = 'MandelPackage', version = '1.0', description = 'This is a demo package', ext_modules = [module1]) #END OF FILEIf you want to install the extension: 'python setup.py install'. This will install it into the site-packages directory.
If you create a setup.cfg containing the text below you can use 'python setup.py build' to build the extension in the current directory
# setup.cfg [build_ext] inplace = 1 # end setup.cfg Ronald On Dec 12, 2006, at 10:19 PM, Gen Kazama wrote:
Hi I'm running python 2.3 on 10.4. i made an application using a C backend and a python frontend.This is a school project and although it works perfectly on the school computers, i have trouble compiling the C code correctly on the mac to make it into a python module (maybe this is because the school computers used python 2.4-ie, an updated version of Python.h).Anyway here is how I compile it at school: gcc -I /usr/include/python2.4 -c mandel.c gcc -shared mandel.o -o mandel.so which works with no flaws. then , I try compiling it on my mac: gcc -I /usr/include/python2.3 -c mandel.c gcc mandel.o -o mandel.so(note: -shared wasn't found on my mac for some reason). I get the following errors:/usr/bin/ld: Undefined symbols: _main _PyArg_ParseTuple _PyInt_FromLong _PyString_FromString _PyTuple_New _PyTuple_SetItem _Py_InitModule4 collect2: ld returned 1 exit statusIf anyone could tell me how to compile this C code into a python module on my mac, i would greatly appreciate it. thanks! _______________________________________________Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig