Embedded Python interpreter, runtime libs, and crashing

P

Peter Newman

I'm embedding a Python interpreter into a project, and compiling with
MSVC. It all runs great in the "Debug" configuration, but everything
gets scary when I switch to "Release".

I've read about things that can go wrong when you use the wrong runtime
library when compiling a program that uses Python. I've done my best to
follow the suggestions I've read, but I still seem to be having trouble.
Here's a summary of how I've configured my project:

Release:
========
- C/C++->Code Generation->Runtime Library: Multithreaded DLL
- Linker->Input->Additional Dependencies: ... python24.lib
- Output EXE runs beside Python24.dll

Debug:
======
- C/C++->Code Generation->Runtime Library: Multithreaded Debug DLL
- Linker->Input->Additional Dependencies: ... python24_d.lib
- Output EXE runs beside Python24_d.dll


The debug configuration works flawlessly. Release is another story
altogther. It usually crashes with a segmentation fault or access
violation (reading memory address 0). At one point it ran, but the code
seemed to be executing in the wrong order (stuff getting called before
initialization functions were finished, etc.)
 
J

jussij

It all runs great in the "Debug" configuration, but
everything gets scary when I switch to "Release".

My suggestion would be to turn on debug information
for the release build.

That would at least let you run the release build inside
the debugger, allowing you to see the call stack of the
offending crash.

Jussi Jumppanen
Author: Zeus for Windows Programmer's IDE
http://www.zeusedit.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top