Here's a small tutorial on how to call your C functions from Python.
Let's make some simple functions in C. We'll call the file
Compiling dynamic libraries on Mac OS X is different from the usual gcc -shared
you might be used to:
Now you have to do something awkward; rename myModule.dylib to myModule.so, so
that Python will find the correct file (this is a bug in Python, it should've
been fixed, but that's as far as I know):
If you are using a system that supports -shared you can simply do this:
On Windows you can reportedly type
Here's a simple program in Python to call your functions:
The output is:
If you are going to make bigger libraries available from Python I strongly
suggest you check out SWIG or Boost Python.