For example let us consider python
class with the following structure in filemult.py
.
mult.py
class Mult:
def __init__(self, first, second):
self.a = first
self.b = second
def multiply(self):
c = self.a*self.b
print 'The result of', self.a, 'x', self.b, ':', c
return c
How could we call multiply
method from class above in C++
Code? (But without PyRun_SimpleString()
function)
main.cpp
#include<python2.7/Python.h>
#include <boost/python.hpp>
int main()
{
Py_Initialize();
int a {10};
int b {5};
... CODE HERE (a*b using python function)
Py_Finalize();
}
I was looking a solution in Cython
and boost.python
but could not find it.
Additional links: