Problem with PyRun_SimpleFile and MFC Application

Mark Hammond mhammond at skippinet.com.au
Tue Nov 25 17:11:56 EST 2003


vincent wehren wrote:
> "Susanne" <susi2000 at web.de> schrieb im Newsbeitrag
> news:188007e5.0311251232.6c4b6254 at posting.google.com...
> | Hello!
> 
> |
> | In have embedded python into my MFC application.
> | It works fine using the PyRun_SimpleString method, giving it a string with
> | some simple commands.
> |
> | When i am using PyRun_SimpleFile instead, my application crashes.
> |
> | I have also created a console application. There i also call
> PyRun_SimpleFile.
> | The console application executes the given script.
> |
> 
>  <Code snipped> >//works fine, only says, that there is no modul called
> CORBA
> 
> |
> | So, does anyone of you have an idea, what i am doing wrong in my mfc app?
> 
> 
> PyRun_SimpleFile() reportedly (and I can second that) when certain compiler
> flags are different from the pythonxx(_d).dll. Try setting your Project
> Settings -> C/C++, Code Generation -> "Use runtime library" - to "(Debug)
> Multithreaded DLL"
> 
> (Don't know if or how this affects any of your MFC stuff though)

Yes, this will be the OPs issue.  However, you don't always use the 
debug CRT - the important thing is to use the *same* CRT as Python 
itself.  So a release build of your app/extension *must* be the 
non-debug in a DLL, and a debug build must use the debug in a DLL.

Mark.





More information about the Python-list mailing list