classification
Title: Debugging native Python modules on Windows with Visual Studio Toolchain
Type: compile error Stage:
Components: Windows Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, jmoguill2, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2021-01-11 18:34 by jmoguill2, last changed 2021-01-11 20:12 by gvanrossum.

Messages (2)
msg384853 - (view) Author: Jeff Moguillansky (jmoguill2) Date: 2021-01-11 18:34
I have a question regarding debugging native Python modules on Windows, with Visual Studio toolchain:

Currently I have a native module (native C code), along with Python API bindings (via Cython), and finally Python code that invokes the native module.  I also use various third-party python modules like Pillow, etc.  

In order to debug on Windows, I have to use the following tricks:
1) Build the native module in Release Mode
2) Disable Compiler Optimization
3) Enable Debug symbols

I can't just use Python distutils out of the box, I have to manually modify the build commands to enable Debugging.

If I just try to build the native module in Debug mode, I get Visual Studio compile errors related to: not being able to mix code built with different C++ runtime libraries.  
Some of the 3rd-party Python modules are only available as Release builds (not Debug builds).

I'm wondering if anyone has encountered a similar issue, and what's your advice?  

On Linux, GNU toolchain, this isn't an issue.  The toolchain lets you mix release and debug libraries, no problem.
msg384862 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-01-11 20:12
Steve, is there a better way?
History
Date User Action Args
2021-01-11 20:12:32gvanrossumsetnosy: + paul.moore, tim.golden, gvanrossum, zach.ware, steve.dower
messages: + msg384862
components: + Windows, - C API
2021-01-11 18:34:18jmoguill2create