debugging into a DLL with embedded Python

Stephen D Evans sde at recombinant.demon.co.uk
Tue Dec 17 11:46:16 EST 2002


If you do not need to debug into any Python ( .c ) code it is possible to
use the standard release distributions. Put a wrapper around the Python
header in your C/C++ source code:

#ifdef _DEBUG
  #undef _DEBUG
  #include "python.h"
  #define _DEBUG
#else
  #include "python.h"
#endif

I insert a temporary DebugBreak(); statement in my C/C++ source code to
force the Visual Studio debugger to be invoked if running extensions via
PythonWin.

If you want to debug into the Python C source then the above wrapper
technique is not valid. You will need the Python source and the debug
versions of the Python libraries...

Stephen D Evans

"Lance" <lbrannma at cablespeed.com> wrote in message
news:uvuaqasehreq78 at corp.supernews.com...
> Hi All,
>
> I embedded Python into a DLL that I call from a GAUSS (a matrix
programming
> language) program. GAUSS passes a string to a C function which, in turn,
> executes Python code.
>
> I would like to debug into the C DLL. I don't need to step into the Python
> code, only the C code.
>
<SNIP>
>
> Can anyone suggest a solution? I'd like to continue using PythonWin, but
> need debug abilities.
>
> I'm using Visual C++ 6.0.
>
> Thanks in advance,
> Lance





More information about the Python-list mailing list