import c-library into python

Roger Hansen rogerha at
Tue May 16 08:11:34 EDT 2000

* Tamer Fahmy
> Haegges wrote:
> > 
> > Hello,
> > I have a library (and the source) written in c. How can I import
> > these lib into python? So, that I can access the c-functions, if
> > possible without changing many c-code!
> Hi!
> There are actually 2 possibilities I know of:
> 1. write a wrapper Python module to your C library.
>    The document on
>    should provide you with information how to do this.

This is a good solution if you only have to wrap a few functions.
However if it's a library I would suggest SWIG 
<Url: >
since wrapping lots of functions are boring and error-prone. But you
should look at the "Extending ..." document above to get the feeling
of things. 


More information about the Python-list mailing list