June 2001
Intermediate to advanced
416 pages
10h 24m
English
The Python interpreter can also be embedded into other applications. When embedding the interpreter on UNIX, you must include the file config.c (usually found in a place such as <python >/lib/python2.1/config/config.c, where <python > is the directory where Python was installed) and link against the library libpython2.1.a. (A comparable but more complex process is required on Windows and the Macintosh. Consult the online documentation for details.) The following functions are used to call the interpreter to execute code and control its operation:
int PyRun_AnyFile(FILE *fp, char *filename)
If fp is an interactive device such as TTY in UNIX, this function calls PyRun_InteractiveLoop(). Otherwise, PyRun_SimpleFile() is called. If ...
Read now
Unlock full access