[C++-sig] self-contained embedding

Philip Winston pwinston at gmail.com
Mon Jul 23 01:01:56 CEST 2007


We're embedding python into a windows app. We want our interpreter to
be self-contained, to use only the modules we provide in a .zip.
Mainly we want it to be okay to use our product if no version of
python is installed, but also to be unaffected by any version of
python which is installed in case it's a different version or altered.

Is there a way to accomplish this via the API?  The Python/C API
reference manual says "An application that requires total control has
to provide its own implementation of Py_GetPath(), Py_GetPrefix(),
Py_GetExecPrefix(), and Py_GetProgramFullPath() (all defined in
Modules/getpath.c)."  And I saw some old message implying this was
necessary in various cases.  To me naively it seems like a
self-contained interpreter would be common situation, so I wanted to
double check there wasn't an easy way to do this that I'm missing.

If providing our own implementations was needed, would we just
maintain a local version of getpath.c or is there some trick to insert
your own implementations?

Thanks!

-Philip



More information about the Cplusplus-sig mailing list