Problems embedding with win2k

Mark mrussell8081 at pacbell.net
Mon Mar 18 15:15:54 EST 2002


I need to embed a python interpreter in C++ applications in both Win2K
and Linux environments.  I have started to work the embedding examples
and have run into problems on the windows side, here is my setup and
problem:

Environment:

Win2K Pro, VC6 SP4

Problem 1—Very High Level Embedding Example:  Access violation in
msvcrtd in debug mode
I work the first example from the Python docs—extending and embedding
sec 5.1.  When I build this in release mode the application runs fine.
 When I compile and run in Debug mode I get an access violation in
msvcrtd.dll.  When the program is run the following two asserts fail:

Dbgheap.c line: 1044
_CrtIsValidHeadPointer(pUserData)
Dbgheap.c line: 1050
_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

When I look back through the trace, this error occurs when in
Py_Initialize() when the site module is being imported.  I am using
the debug multithreaded dll runtime for debug and the multithreaded
dll runtime for release.  I am sure I must have a project setting
wrong but I can't figure out exactly what.

Problem 2—Pure Embedding Example—Access violation in python22.dll
When the pure embedding example is built in release mode using the
multithreaded dll runtime, I get and access violation.  When I try to
build and run in debug mode I get the same problem in Py_Initialize()
as described in Problem 1.

If anyone has seen this problem and can suggest a way forward I would
be very grateful.



More information about the Python-list mailing list