By definition, "embedding" means doing it the other way around, like
>What I was looking for was something that looks as follows.
>int load_python_program(char *pathname_to_python_program)
> /* Or some function to initialize and load python */
>int run_python_program_with_arguments(arg1 arg2 arg3.....argn)
> /* call some procedure in the loaded program */
Such a simple interface currently does not exist, but it shouldn't be
too hard to create it, or something similar.
I hope you're a bit adventurous; then you can read pythonmain.c and
figure out how to do it. Basically, you'll need to move all functions
from that file elsewhere, and add calls to initpython() (at least) and
setpythonpath() (probably) and setpythonargv() (perhaps) to your own
main program. You can then call routines like run_command(string) or
run(FILEpointer, filename) to execute Python code as you wish. There
are other run_*() functions that provide more flexibility, like
choosing which environment to use.
You'll probably find that the Python code run in this way needs access
to funactionality defined in your application, and for *that* you'll
need to do everything described in misc/EXTENDING.
--Guido van Rossum, CWI, Amsterdam <firstname.lastname@example.org>
"What's so unpleasant about being drunk?"
"Go ask a glass of water!"