Good examples for Embedding python in C, C++

H

Henko Gouws (H)

Hallo

I am looking for good examples on how to call a python script from C,
C++ and pass parameters (list of strings) to the python script. The
aim is to ultimately allow the end-user to modify the python script,
without any code recompilation, to suit the needs of the end-user.
The C, C++ part will remain intact.

I could not find good examples, that could help me with this, in the
references from python.org. I would appreciate your help.

thanks
Henko
 
R

Rick Ratzel

I did a presentation on this very topic at PyCon this year:

http://elmer.sourceforge.net/PyCon04/elmer_pycon04.html

...and here is the complete example code:

http://elmer.sourceforge.net/PyCon04/Elmer_PyCon04.tgz

You can use Elmer (http://elmer.sourceforge.net) to automatically
generate the C equivalent to a Python API. When run in "frozen" mode,
the resulting application is self-contained...but when run in "warm"
mode, a user can modify the python sources without any code
recompilation, like you said.

-Rick Ratzel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top