Calling C libraries from a Python script
Dave Kuhlman
dkuhlman at rexx.com
Sat Apr 5 12:48:40 EST 2003
Tim Gahnström /Bladerman wrote:
> "Joshua Goodlett" <joshua at goodish.org> wrote in message
>> I'm trying to find examples of calling C library functions from within
>> a Python script. Any advice or pointers on where to look for examples
>> would be appreciated.
>
>
> There is a whole chapter in the docs dedicated to the subject,
>
> Have a look at
>
> http://www.python.org/doc/current/ext/ext.html
Also look at SWIG. It attempts to generate for you what the above doc tells
you how to do. If you use SWIG, you may be able to write/generate that
code without learning anything, except how to use SWIG of course. Feed
SWIG a C header file (or a SWIG interface definition file) that describes
the functions you want to call and SWIG will generate the C wrappers that
enable you to call those functions from Python.
http://www.swig.org/
- Dave
--
Dave Kuhlman
dkuhlman at rexx.com
http://www.rexx.com/~dkuhlman
More information about the Python-list
mailing list