[Tutor] Embedding Python in C

Walter Vannini walterv@jps.net
Sun, 13 May 2001 14:07:29 -0700


I ran into the same problem with python 2.0.
I didn't want to turn off debug mode, so instead I modified config.h.
(and of course kept a backup of the original).
Line 432 was changed from:
#pragma comment(lib,"python20_d.lib")
to
#pragma comment(lib,"python20.lib")

I would expect that a similar fix will work for 2.1.

The lines near 432 were
431 #ifdef _DEBUG
432 #pragma comment(lib,"python20_d.lib")
433 #else
434 #pragma comment(lib,"python20.lib")
435 #endif

Incidentally, instead of hardcoding the linking of the python library
in source code via Microsoft pragmas, one could simply link explicitly.
In that case, lines 431 to 435 of config.h should be commented out.

Walter.

Daniel Yoo wrote:
> 
> On Sat, 1 Jan 2000, KonradRawlik wrote:
> 
> > I have the following problem and hope that somebody can help me with it.
> >
> > I was trying to run simple statement strings from a C programm, by
> > PyRun_SimpleString() . But it wouldn't even compile cause I got the link
> > error
> > ' cannot open file "python21_d.lib" '. Now the problem is, there is no
> > such lib with the Python 2.1 pack I downloaded, so why isn't it there
> > and where can I get it, or am I making something completly wrong? I'm
> > using MSVC 6.0.
> 
> I sounds like it's looking for the debug version of the Python library.
> However, instead of getting the debug library, you might want to turn off
> MSCV's debug mode off altogether: from what I've heard, it's not useful at
> all when writing Python extensions.
> 
> The Python web site has the following written about it:
> "Python-2.1-Debug.zip is a set of DLLs for Windows developers compiled in
> debug mode; it contains nothing of value for regular Python users."
> 
> Still, if you need it, you can download it here:
> 
>     http://python.org/ftp/python/2.1/Python-2.1-Debug.zip