Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding python script to c++ project

How would I go about adding a script written in python to a c++ project? Thanks

Edit: Basically all the script does is email some data. I would like to pass the data and maybe the email address to a function written in python. Hope that clears things up..

like image 520
jon Avatar asked Feb 03 '26 06:02

jon


2 Answers

You could look at Boost.Python which is a "a C++ library which enables seamless interoperability between C++ and the Python programming language."

You have to be more specific, though.

like image 70
Alexandros Gezerlis Avatar answered Feb 04 '26 19:02

Alexandros Gezerlis


You may be interested in Boost.Python: Embedding the Interpreter, or Python/C API: Embedding the Python Interpreter. You can either use the Python C APIs directly or use the Boost.Python library as you so choose. You might also be interested in reading Embedding Python in Your C Programs which walks you through it.

like image 36
Michael Aaron Safyan Avatar answered Feb 04 '26 18:02

Michael Aaron Safyan