[C++-sig] wrap C++ function with private copy constructor

Ravi lists_ravi at lavabit.com
Wed Jul 20 03:49:54 CEST 2011


On Wednesday 13 July 2011 07:19:44 Manuela Kaelberer wrote:
> I have to wrap a C++ API for Python. There are a couplt of difficulties:
> - The C++ classes have private constructors.

Use boost:python::no_init in class_<...>.

> - pointers to class instances are parameters for functions

This is not a problem since boost.python handles pointers and references in 
function parameter lists automatically.

> - callbacks that are initiated by the C++ side, but call functions
> implemented on the Python side.

This is a little tricky but is well-covered in the documentation:
  http://www.boost.org/doc/libs/1_47_0/libs/python/doc/tutorial/doc/html/python/exposing.html#python.virtual_functions_with_default_implementations

Regards,
Ravi



More information about the Cplusplus-sig mailing list