I want to execute the helloword.cpp code, which takes some argument from the console, parses those arguments, and then prints "hello world" in the console.
Now I want to parse these arguments from python scripts parsearguments.py
So for example:
def parse_arguments: ...# some code return arguments
Now, how do I communicate between python and C ++. I read and see that cython, boost python are options, but it's hard for me to find the right simple greeting example.
Any suggestions would be appreciated. Thanks
, Python, ++? , Python subprocess ++ .
subprocess
++ , , , unix.
boost:: python , .
++ python, boost python, : http://www.boost.org/doc/libs/1_59_0/libs/python/doc/index.html ++.
C, python ctypes.
C/++ .
, Boost.python, - SIP SWIG ( Wrapper Interface Generator). Boost, SIP SWIG .
SWIG , . C ++ , ( ) Python, Perl, Lua, Tcl/Tk, Ocaml, Ruby, Java. SWIG , ++. . , . , ++ 2003, ++ 11. , . , .
Using boost.python sounds like a good solution to me. But depending on your experience in C ++, this can be quite complicated. Good point to start:
http://wiki.python.org/moin/boost.python
Boost.Python allows you to export C ++ classes and member functions in Python to be able to use them from there.