How to import C++ static library?

Diez B. Roggisch deets at nospam.web.de
Tue Apr 15 05:11:40 EDT 2008


Alexander Dong Back Kim wrote:

> Hi all,
> 
> I'm very very beginner of python but I'm dare to ask this question
> straight away. =P
> 
> Is it possible to import C++ static library compiled by GCC? The
> target is definitely Linux machine.
> 
> I found some examples from Google showing the way C++ can import
> Python so called embedded python. But I want to the opposite way of
> this. I want to import (or include in C world terminology) the library
> which is a blah.a file to reuse in python.
> 
> Any suggestion or idea for this stupid beginner? ;)

For C++, you need to create a wrapping using C++ wrapper tools. There are a
few available: SWIG, Boost::Python and SIP.

I can only comment personally on the latter - and can recommend it without
any doubt.

Diez



More information about the Python-list mailing list