Python – How to use C++ libraries from python

How to use C++ libraries from python… here is a solution to the problem.

How to use C++ libraries from python

I would like to know how to use python to call libwpd named libwpd The C++ library reads word perfect files and builds python objects from them, but I have no experience using C++ or calling C++ functions from python, and I don’t understand how to figure out what the output of these library functions is. So it’s really two questions: 1) how to call C++ functions from python, and 2) how to calculate the output of these functions, i.e., the result of the WPDocument:

  • :p arse function (see ). http://www.abisource.com/~uwog/libwpd/) and how to use it in my python code. The function seems to return an object WPDResult, but I don’t know what it does or how I’m going to use it.

I briefly looked at SWIG and it looks promising. Idea?

Solution

Boost.Python library allows easy interoperability between C++ and Python.

tutorial shows how to wrap C++ functions and classes in Python to use them.

Related Problems and Solutions