Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export variable into python from C++ using boost.python

I have, for example, a varibale in c++:

const float Pi = 3.1415926535898f;

What is the best way to export it into python-module using boost.python?

I want to access it as variable in global scope.

like image 388
Max Frai Avatar asked Mar 15 '11 19:03

Max Frai


1 Answers

Seems that it can be easily done using:

boost::python::scope().attr("Pi") = Pi; 
like image 108
Max Frai Avatar answered Sep 28 '22 23:09

Max Frai