Newbie question: embedding python in a c++ main

Gordon McMillan gmcm at hypernet.com
Tue Jul 6 10:43:46 EDT 1999


Yishai Beeri writes:

> I am trying to embed the python interpreter in a c++ program. All it
> does is a simple main, which initializes python, initializes several
> python modules (extensions written in c++), and run a python
> program.
> 
> When I read the python program into a char* and use
> PyRun_SimpleString, it seems to work fine. However, when I try to
> use PyRun_SimpleFile, after opening the file, I get a crash
> somewhere inside the PyParser functions.

The most likely problem is using a different C runtime lib in your 
program than is used by python. Fits the symptoms (works until you 
try to pass a FILE around), though without knowing the specific error 
this is just a guess.

python15.dll is linked to the multithreaded DLL C runtime.

- Gordon




More information about the Python-list mailing list