Using External Libraries with python?

Chris Mellon arkanes at gmail.com
Thu Jan 4 13:42:30 EST 2007


On 1/4/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Ognjen Bezanov schrieb:
> > I have some external C libraries I would like to use with python.
> >
> > I have been searching on the internet and found many such
> > modules/bindings for libraries (e.g. Py-Lame) but have not yet
> > come across any information of how to actually go about creating such
> > bindings, so I was wondering if anybody here could point me in the right
> > direction?
>
> There are several methods. One is to write a Python C module by hand,
> using the Python C API:
>
> http://docs.python.org/ext/ext.html
> http://docs.python.org/api/api.html
>
> Essentially, all you need is a DLL/shared-object with an init
> function.
>
> Other solutions include tools that generate extension modules
> automatically (such as SWIG or Pyrex), or using libraries on
> top of the C API (such as Boost.Python).
>
> I personally always use the C API directly.
>
> Regards,
> Martin

Don't forget calling the using the external library directly from
Python by using ctypes.



More information about the Python-list mailing list