How to use PyRun_SimpleFile() from a window application

Duebendorfer Marco (Dub) marco.duebendorfer at
Tue Jan 15 14:56:38 EST 2002


I just spent more than two hours to figure out how to use PyRun_SimpleFile()
from a Win32 application without a crash. I'd like to share my experiences
with you. Searching trough the mailing lists showed me that this is a
frequent problem.

As most of you pointed out, you must use the same C-runtime library for the
python22.dll and your windows application. The following list shows the
windos C run-time debug libraries (without iostream).

C RT lib     Characteristics              Option    Defined 
LIBCD.LIB    Single-threaded, static link   /MLd   _DEBUG
LIBCMTD.LIB  Multithreaded, static link     /MTd   _DEBUG, _MT
MSVCRTD.LIB  Multithreaded, dynamic link    /MDd   _DEBUG, _MT, _DLL

Python22_d.dll uses the dynamic link "MSVCRTD.LIB" library. If you are
building an application (debug version) you must use the flags "/MDd". I
used the multithreaded library, but did not spend attention to use the
*dynamic* version of it. 

Hope this helps to somebody.

> Regards, Marco

More information about the Python-list mailing list