[Tutor] Importing C,C++,Asm modules
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Fri May 6 22:54:17 CEST 2005
On Wed, 4 May 2005, Ali Polatel wrote:
> Dear friends,
> Is there a way to import C,C++ or Asm modules to python scripts?
> If yes how?
Hi Ali,
Python can be "extended" to use external libraries, as long as we can call
them from C. There's a tutorial for C programmers here:
http://docs.python.org/ext/ext.html
There are several projects out there to make the process less painful.
One of these is SWIG:
http://www.swig.org
and there are several other packages out there, including the PyRex
project:
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
In short, if you can do a C function call, you can integrate it with
Python, and it might not even be too bad. If you have a particular
example in C, I'm sure that one of us here would be happy to demonstrate
how to expose that function in Python.
Good luck!
More information about the Tutor
mailing list