26
votes
6answers
6k views

Exposing a C++ API to Python

I'm currently working on a project were I had to wrap the C++ classes with Python to be able to script the program. So my specific experience also involved embedding the Python interpreter in our ...
11
votes
3answers
11k views

help needed with boost python

Hai friends, I've installed boost python from ubuntu 9.04 repositories.. I've successfully run the Build a Simple Program Using Boost from the tutorial ...
11
votes
2answers
647 views

how to extract a unicode string with boost.python

It seems that the code will crash when I do extract<const char*>("a unicode string") Anyone know how to solve this?
9
votes
1answer
4k views

BoostBuild: patchlevel.h does not exist

I'm trying to compile a C++ project using bjam on Ubuntu 11.04. I keep getting the following error: ../../libraries/boost_1_44_0/boost/python/detail/wrap_python.hpp:75:24: fatal error: patchlevel.h: ...
9
votes
1answer
2k views

Boost and Python 3.x

How boost.python deal with Python 3 ? Is it Python 2 only ? Thank you.
9
votes
1answer
445 views

Boost.Python: Callbacks to class functions

I have an EventManager class written in C++ and exposed to Python. This is how I intended for it to be used from the Python side: class Something: def __init__(self): ...
8
votes
6answers
650 views

Python-style pickling for C++?

Does anyone know of a "language level" facility for pickling in C++? I don't want something like Boost serialization, or Google Protocol Buffers. Instead, something that could automatically ...
8
votes
1answer
2k views

Boost.Python call by reference : TypeError: No to_python (by-value) converter found for C++ type:

I'm trying to expose my C++ Classes to Python using Boost.Python. Here is a simplyfied version of what i'm trying to do: I have a class A deriving from boost::noncopyable and a second class B with a ...
7
votes
3answers
2k views

Boost::python Exposing C++ functions using and returning templates

I need to build python bindings for a C++ codebase. I use boost::python and I ran into problems trying to expose classes containing functions using and returning templates. Here is a typical example ...
6
votes
5answers
372 views

Need help getting started with Boost.Python

I'm trying to build my first Boost.Python example. #include <iostream> #include <boost/python.hpp> using namespace boost::python; class Hello { public: std::string greet() { ...
6
votes
3answers
2k views

Boost::Python- possible to automatically convert from dict --> std::map?

I've got a C++ class, with a member function that can take a small-to-large number of parameters. Lets name those parameters, a-f. All parameters have default values. As a part of the python ...
6
votes
1answer
993 views

Exposing a pointer in Boost.Python

I have this very simple C++ class: class Tree { public: Node *head; }; BOOST_PYTHON_MODULE(myModule) { class_<Tree>("Tree") .def_readwrite("head",&Tree::head) ; ...
6
votes
2answers
2k views

passing C++ classes instances to python with boost::python

I have a library which creates objects (instances of class A) and pass them to a python program which should be able to call their methods. Basically I have C++ class instances and I want to use them ...
6
votes
2answers
4k views

boost::python: Python list to std::vector

Finally I'm able to use std::vector in python using the [] operator. The trick is to simple provide a container in the boost C++ wrapper which handles the internal vector stuff: #include ...
6
votes
2answers
2k views

SWIG, boost shared pointers and inheritance

I'm having trouble with SWIG, shared pointers, and inheritance. I am creating various c++ classes which inherit from one another, using Boost shared pointers to refer to them, and then wrapping these ...

1 2 3 4 5 19
15 30 50 per page