- authors
André Caron
- contact
This library provides a simple API for consuming Python code bases from C++. The intent of this library is to be a small, lightweight wrapper on the Python C API, easing the embedding of Python into C++ applications.
Differences with Boost.Python
If Boost is so great, why not use Boost.Python? Well, Boost is a huge library which is not installed by default on many systems (most notably Microsoft Windows) and it takes a short eternity to compile programs that use it. Moreover, Boost.Python is mostly designed for exporting C++ classes to use them from Python with embedding added on as an afterthought.
This library is by no means intended as a replacement, or even a substitute of Boost.Python. If you want to write Python bindings for your C++ classes, please use Boost.Python (or SWIG). If you just want a quick way to consume Python software libraries from C++ without heavy dependencies, then use this library.
- CPython. Only works with the reference implementation, not Jython, IronPython or other variants which don't have an interface for C. Make sure to install a version that is compatible with your C++ compiler toolchain. If you don't have a 64-bit compiler, you can't use 64-bit Python.
- A C++ compiler toolchain:
- Microsoft Visual Studio (for Microsoft Windows). The code base has not been tested on versions prior to 2008. Should work on both the Express and Professional versions.
- GCC (for UNIX-like systems)
- CMake
- Git (unless you download the sources as an archive)
- Doxygen (to build the API documentation)
- Open up a terminal (command prompt).
Get the source code.
git clone git://github.com/AndreLouisCaron:cxxpy.git cd cxxpy
Have CMake generate build scripts.
mkdir work cd work cmake -G "NMake Makefiles" ..
Build using your favorite toolchain.
nmake
- Enjoy!