Good Morning Sir,
I have referred this article, Embedding Python program in a C/C++ code[^] I have followed up the tutorial and successfully embedded Python in my code.PyRun_SimpleString("print('Hello World from Embedded Python!!!')");
s used to execute a single line of Python code but how do I run a multiple lines of code in Python. I also tried running a Python from a file but the file also needed to be there for running the executable. Cry | :(( I dont want a file along with my executable, I searched in the google sir but I find no results.
I am confused here, I dont know what to doConfused | :confused:
Thank you sir for your time
What I have tried:
1. tried to contact the author of the article, waited for a month and he is unresponsive.
2. Tried some Googling but I don't find anything relevant, and I am still waiting for the author to respond.
Any help is much appreciated
Thank you sir for your time!
解决方案Well, you could simply turn the python file into binary and compile/link it into your program binary. At run time, take the compiled binary text (which should be some const char* at this point) and feed it to Python as a string.
This approach however, makes your application have to compile every time you need any Python changes... which loses a big part of the desirability of using Python in the first place. In another words... at that point why use Python at all?