[prev in list] [next in list] [prev in thread] [next in thread]
List: pythonmac-sig
Subject: Re: [Pythonmac-SIG] Extending Python (OS 10.3.9)
From: "Chris Barker" <Chris.Barker () noaa ! gov>
Date: 2005-09-30 19:36:40
Message-ID: 433D93C8.7010700 () noaa ! gov
[Download RAW message or body]
The best advice I can give you is to use distutils to do the compiling
for you. It knows about all the include and linking directories that are
required:
http://docs.python.org/dist/dist.html
If your case is simple, which it seems to be so far, you can write a
very simple setup.py script, and build with:
python setup.py build.
As a bonus, you can use the same setup.py to build on other platforms.
Here is a simple example:
#!/usr/bin/env python2.3
from distutils.core import setup, Extension
setup (name = "MyModule",
version = "1.0",
ext_modules = [Extension('MyModule',sources=['MyModule.c'])]
)
This will build the C file: MyModule.c into an extension library MyModule.so
One other suggestion:
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
Look into using pyrex instead of dealing with all that raw C.
Or, if you are working with a C or C++ library, look into SWIG or
Boost::python
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic